메시지 상자가 계속 깜박입니다. 충돌은 없지만 열리고 다시 열립니다. 이 문제를 어떻게 해결할 수 있습니까?python qt 메시지 상자에서 오류가 발생했습니다.
self.retranslateUi(Login)
QtCore.QObject.connect(self.ExitButton, QtCore.SIGNAL(_fromUtf8("clicked()")), Login.close)
QtCore.QObject.connect(self.LoginButton, QtCore.SIGNAL("clicked()"),self.get_value_from_user)
QtCore.QMetaObject.connectSlotsByName(Login)
Login.setTabOrder(self.LoginButton, self.UsernameEdit)
Login.setTabOrder(self.UsernameEdit, self.PasswordEdit)
Login.setTabOrder(self.PasswordEdit, self.ExitButton)
def get_value_from_user(self):
Correct_details = False
while Correct_details==False:
inputusername=self.UsernameEdit.text()
inputpassword=self.PasswordEdit.text()
cur.execute("SELECT password FROM tblStaff WHERE username='"+inputusername+"'")
password=str(cur.fetchone())
password=password[2:-3]
cur.execute("SELECT firstname FROM tblStaff WHERE username='"+inputusername+"'")
FirstName=str(cur.fetchone())
FirstName=FirstName[2:-3]
cur.execute("SELECT surname FROM tblStaff WHERE username='"+inputusername+"'")
Surname=str(cur.fetchone())
Surname=Surname[2:-3]
if str(password) == str(inputpassword):
self.msgBox1 = QMessageBox(QMessageBox.Information,'Successful', "Succesfully Logged in")
self.msgBox1.show()
Correct_details = True
else:
self.msgBox2 = QMessageBox(QMessageBox.Information, 'Warning', "The Username or Password you have entered is incorrect")
self.msgBox2.show()
get_value_from_user가 호출 될 때/어디에서 표시 할 수 있습니까? –
예, 로그인 버튼을 눌렀을 때 호출 됨 – Thaz