The messagebox keeps 'flashing' :s. It doesn't crash, but it just keeps on opening and re-opening. How could I fix this problem?
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()