用户:姚国栋udn0查看:0 回复:0 评论:0 创建时间:2024-01-07T21:12:49
【作品展示】

【作品介绍】
PyQt5代码2
【作品源代码】
from PyQt5.QtWidgets import QDesktopWidget,QApplication,QMainWindow
import sys
class Winform( QMainWindow):
def __init__(self,parent=None):
super( Winform,self).__init__(parent)
self.setWindowTitle('主窗口放在屏幕中间例子')
self.resize(370,250)
self.center()
def center(self):
screen = QDesktopWidget().screenGeometry()
size = self.geometry()
self.move((screen.width() - size.width()) / 2,(screen.height() - size.height()) / 2)
if __name__ == "__main__":
app = QApplication(sys.argv)
win = Winform()
win.show()
sys.exit(app.exec_())
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn