PythonGui->对话框

来源:互联网 发布:淘宝运动鞋 编辑:程序博客网 时间:2024/06/05 21:49
<span style="font-size:24px;">import sysfrom PyQt4 import QtGuiclass MessageBox(QtGui.QWidget):    def __init__(self, parent=None):        QtGui.QWidget.__init__(self, parent)        self.setGeometry(300, 300, 250, 150)        self.setWindowTitle('message box')    def closeEvent(self, event):        reply = QtGui.QMessageBox.question(self, 'Message', \                                           'Are you sure to quit?',\                                           QtGui.QMessageBox.Yes, QtGui.QMessageBox.No)        if reply == QtGui.QMessageBox.Yes:            event.accept()        else:            event.ignore()                    app = QtGui.QApplication(sys.argv)mb = MessageBox()mb.show()sys.exit(app.exec_())</span>

0 0
原创粉丝点击