import sys from PyQt5.QtWidgets import QApplication, QWidget, QPushButton from PyQt5.QtCore import QCoreApplication class Example(QWidget): def __init__(self): super().__init__() self.initUI() def initUI(self): quit = QPushButton('退出', self) quit.clicked.connect(QCoreApplication.instance().quit) quit.move(50, 50) self.setGeometry(300, 300, 250, 150) self.setWindowTitle('关闭窗口') self.show() if __name__ == '__main__': app = QApplication(sys.argv) ex = Example() sys.exit((app.exec_()))
转载请注明作者与出处:http://blog.csdn.net/u013511642
王小涛_同學
时间: 2024-10-26 15:57:32