pyqt demo

# -*- coding: utf-8 -*-

"""
Module implementing MyDialog.
"""

from PyQt4.QtCore import pyqtSignature
from PyQt4.QtGui import QDialog

from PyQt4.QtGui import QApplication
from PyQt4.QtGui import QMessageBox
from PyQt4 import QtCore

from Ui_maindlg import Ui_Dialog

try:
    _fromUtf8 = QtCore.QString.fromUtf8
except 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 NotImplementedError

if __name__ == "__main__":
    import sys
    app = QApplication(sys.argv)
    Dialog = MyDialog()
    Dialog.show()
    sys.exit(app.exec_())
    

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值