标签:gets reply set pyqt window sel __name__ box rom
import sys from PyQt5.QtWidgets import QApplication, QWidget, QMessageBoxclass Example(QWidget): def __init__(self): super().__init__() self.initUI() def initUI(self): self.resize(250, 155) self.setWindowTitle(‘title‘) self.show() # 重写closeEvent()事件方法 def closeEvent(self, event): # 显示消息框 reply = QMessageBox.question(self, ‘Message‘, "Are you sure to quit?", QMessageBox.Yes | QMessageBox.No, QMessageBox.Yes) if reply == QMessageBox.Yes: event.accept() else: event.ignore() if __name__ == ‘__main__‘: app = QApplication(sys.argv) ex = Example() sys.exit(app.exec_())
QMessageBox options:
标签:gets reply set pyqt window sel __name__ box rom
原文地址:https://www.cnblogs.com/yutb/p/12199876.html