pyqt demo

来源:互联网 发布:人工智能的概念 编辑:程序博客网 时间:2024/06/05 07:45
# -*- coding: utf-8 -*-"""Module implementing MyDialog."""from PyQt4.QtCore import pyqtSignaturefrom PyQt4.QtGui import QDialogfrom PyQt4.QtGui import QApplicationfrom PyQt4.QtGui import QMessageBoxfrom PyQt4 import QtCorefrom Ui_maindlg import Ui_Dialogtry:    _fromUtf8 = QtCore.QString.fromUtf8except AttributeError:    def _fromUtf8(s):        return s        class MyDialog(QDialog, Ui_Dialog):    """    Class documentation goes here.    """    def __init__(self, parent=None):        """        Constructor                @param parent reference to the parent widget (QWidget)        """        QDialog.__init__(self, parent)        self.setupUi(self)        @pyqtSignature("")    def on_pushButton_clicked(self):        """        Slot documentation goes here.        """        self.label.setText("xxx")        self.pushButton.setText('ok')                # TODO: not implemented yet        #raise NotImplementedError        @pyqtSignature("")    def on_pushButton_exit_clicked(self):        """        Slot documentation goes here.        """        QMessageBox.information(self, _fromUtf8("system标题"), _fromUtf8("warning消息"), QMessageBox.Yes)        QMessageBox.information(self,"english","test",QMessageBox.Yes)                Dialog.close()        # TODO: not implemented yet        #raise NotImplementedErrorif __name__ == "__main__":    import sys    app = QApplication(sys.argv)    Dialog = MyDialog()    Dialog.show()    sys.exit(app.exec_())    

0 0
原创粉丝点击