0
該應用程序以一個登錄窗體開始,當用戶和密碼正確時,它啓動主窗口。我無法關閉登錄表單(QWidget)。當一個子窗口打開時關閉父窗口
def on_pushButton_login_clicked(self):
username = str(self.ui.lineEdit_usuario.text())
password = str(self.ui.lineEdit_password.text())
if login_user(username, password):
# Hide error if Login fail
self.ui.label_error.hide()
window = Main() # QMainWindow
try:
window.exec_()
except AttributeError:
pass
#self.close() # close LoginForm & open QMainWindow
else:
self.ui.lineEdit_usuario.setFocus()
self.ui.lineEdit_usuario.clear()
self.ui.lineEdit_password.clear()
# Show error if Login fail
self.ui.label_error.show()