28 May 2020
please am try to do a registration validation on PYQT5 where the users input is not filled in a particular LineEdit a MessageBox should display showing a warning message for the user to fill the LineEdit omitted i.e in web aspect if Email Text field is not filled a script alert display to the user to fill in his or her emai.
this is my code: def CreateTab(self):
uname = self.UnamelineEdit.text()
email = self.MaillineEdit.text()
pword = self.PwordlineEdit.text()
con = sqlite3.connect("databasename")
con.execute("INSERT INTO USER(USERNAME,EMAIL,PASSWORD) VALUES(?,?,?)", (uname, email, pword))
if UnameLineEdit.text == "":
print("invalid")
else:
print("data inserted")
con.commit()
con.close()
msg = QMessageBox()
msg.setWindowTitle("Confirmation")
msg.setText("Registeration successful!")
msg.setIcon(QMessageBox.Information)
msg.setStandardButtons(QMessageBox.Retry | QMessageBox.Ignore | QMessageBox.Cancel)
msg.setDefaultButton(QMessageBox.Ignore)
x = msg.exec_()