亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費(fèi)注冊 查看新帖 |

Chinaunix

  平臺(tái) 論壇 博客 文庫
最近訪問板塊 發(fā)新帖
查看: 3821 | 回復(fù): 1
打印 上一主題 下一主題

pyqt中的self.accept()不管用 [復(fù)制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報(bào)告]
發(fā)表于 2012-12-10 10:54 |只看該作者 |倒序?yàn)g覽
代碼如下:
from PyQt4 import QtGui, QtCore
try:
    _fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
    _fromUtf8 = lambda s: s
class Ui_Dialog( QtGui.QDialog):
    def setupUi(self, Dialog):
        Dialog.setObjectName(_fromUtf8("Dialog")
        Dialog.resize(670, 596)
        Dialog.setInputMethodHints(QtCore.Qt.ImhNone)
        Dialog.setModal(False)
        self.pushButton = QtGui.QPushButton(Dialog)
        self.pushButton.setGeometry(QtCore.QRect(100, 310, 101, 31))
        self.pushButton.setObjectName(_fromUtf8("pushButton")
        self.pushButton_2 = QtGui.QPushButton(Dialog)
        self.pushButton_2.setGeometry(QtCore.QRect(320, 310, 91, 31))
        self.pushButton_2.setObjectName(_fromUtf8("pushButton_2")
        self.label = QtGui.QLabel(Dialog)
        self.label.setGeometry(QtCore.QRect(80, 60, 111, 41))
        font = QtGui.QFont()
        font.setFamily(_fromUtf8("黑體")
        font.setPointSize(20)
        font.setBold(True)
        font.setWeight(75)
        self.label.setFont(font)
        self.label.setObjectName(_fromUtf8("label")
        self.label_2 = QtGui.QLabel(Dialog)
        self.label_2.setGeometry(QtCore.QRect(80, 140, 111, 31))
        font = QtGui.QFont()
        font.setFamily(_fromUtf8("黑體")
        font.setPointSize(20)
        font.setBold(True)
        font.setWeight(75)
        self.label_2.setFont(font)
        self.label_2.setObjectName(_fromUtf8("label_2")
        self.lineEdit = QtGui.QLineEdit(Dialog)
        self.lineEdit.setGeometry(QtCore.QRect(200, 70, 191, 31))
        font = QtGui.QFont()
        font.setFamily(_fromUtf8("黑體")
        font.setPointSize(16)
        font.setBold(True)
        font.setWeight(75)
        self.lineEdit.setFont(font)
        self.lineEdit.setEchoMode(QtGui.QLineEdit.Normal)
        self.lineEdit.setObjectName(_fromUtf8("lineEdit")
        self.lineEdit_2 = QtGui.QLineEdit(Dialog)
        self.lineEdit_2.setGeometry(QtCore.QRect(200, 140, 191, 31))
        font = QtGui.QFont()
        font.setFamily(_fromUtf8("黑體")
        font.setPointSize(16)
        font.setBold(True)
        font.setWeight(75)
        self.lineEdit_2.setFont(font)
        self.lineEdit_2.setEchoMode(QtGui.QLineEdit.Password)
        self.lineEdit_2.setObjectName(_fromUtf8("lineEdit_2"))

        self.retranslateUi(Dialog)
        QtCore.QObject.connect(self.pushButton_2, QtCore.SIGNAL(_fromUtf8("clicked()")), Dialog.close)
        QtCore.QObject.connect(self.pushButton, QtCore.SIGNAL(_fromUtf8("clicked()")), self.login)
        QtCore.QMetaObject.connectSlotsByName(Dialog)

    def retranslateUi(self, Dialog):
        Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "Dialog", None, QtGui.QApplication.UnicodeUTF)
        self.pushButton.setText(QtGui.QApplication.translate("Dialog", "確定", None, QtGui.QApplication.UnicodeUTF)
        self.pushButton_2.setText(QtGui.QApplication.translate("Dialog", "取消", None, QtGui.QApplication.UnicodeUTF)
        self.label.setText(QtGui.QApplication.translate("Dialog", "用戶名:", None, QtGui.QApplication.UnicodeUTF)
        self.label_2.setText(QtGui.QApplication.translate("Dialog", "密  碼:", None, QtGui.QApplication.UnicodeUTF)
   
        
    def login(self):
        if self.lineEdit.text()== u'admin' and  self.lineEdit_2.text()== u'admin':
            # 如果用戶名和密碼正確,關(guān)閉對(duì)話框,accept()關(guān)閉后,如果增加一個(gè)取消按鈕調(diào)用reject()
            
            self.accept()

        else:
            QtGui.QMessageBox.critical(self, 'Error', 'User name or password error')
   
class myyy(QtGui.QDialog):   
    def __init__(self, parent=None):
        QtGui.QDialog.__init__(self, parent)
        self.ui=Ui_Dialog()
        self.ui.setupUi(self)
   

if __name__ == '__main__':
    import sys
    app = QtGui.QApplication(sys.argv)
    log=myyy()
    if log.exec_()==QtGui.QDialog.Accepted:
        win = QtGui.QMainWindow()
        win.show()
        sys.exit(app.exec_())
點(diǎn)擊“確定”不能關(guān)閉,小弟初學(xué),請(qǐng)大家?guī)兔Γ?/td>

論壇徽章:
0
2 [報(bào)告]
發(fā)表于 2012-12-10 17:08 |只看該作者
已經(jīng)搞定了,是自己弄錯(cuò)了!
您需要登錄后才可以回帖 登錄 | 注冊

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號(hào)-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號(hào):11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報(bào)專區(qū)
中國互聯(lián)網(wǎng)協(xié)會(huì)會(huì)員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請(qǐng)注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP