import sys from PyQt5.QtWidgets import QApplication, QWidget from PyQt5.QtGui import QIcon class Example(QWidget): def __init__(self): super().__init__() self.initUI() def initUI(self):
# 设置长宽和显示坐标x,y # self.setGeometry(400,400,500,500)
# 同样 self.resize(500,500) self.move(300,300)
# 窗口标题 self.setWindowTitle('Icon')
self.show() if __name__ == '__main__': app = QApplication(sys.argv) ex = Example() sys.exit(app.exec_())