[PyQt] Problem calling a window
Sergio Jovani
lesergi at gmail.com
Wed Jan 14 13:39:04 GMT 2009
It would be good you post more code, at least, Pro2MainWindow class.
2009/1/14 Sandro Dutra <hexodin at gmail.com>:
> I get a AttibuteError in mainWnd.exec_()
>
> If necessary, I can upload the complete code.
>
> Thanks in advance.
>
> 2009/1/13 Sergio Jovani <lesergi at gmail.com>
>>
>> Hi,
>>
>> This is a little piece of code, but you can try with:
>>
>> mainWnd = Pro2MainWindow()
>> mainWnd.exec_()
>> mainWnd.showMaximized()
>> self.hide()
>>
>> 2009/1/13 Sandro Dutra <hexodin at gmail.com>:
>> > I'm writing a solution using Python, Qt and MySQL, I create the login
>> > screen
>> > and set all the errors...
>> >
>> > The problem is: When the user do the correct login in MySQL, I want the
>> > login screen to close, and the whole application show.
>> >
>> > The code when the button "Enter" is pressed:
>> > ---------------------------
>> > def on_pushButton_enter_clicked(self):
>> > user = self.lineEdit_user.text()
>> > passw = self.lineEdit_passw.text()
>> > if user == "" or passw == "":
>> > QMessageBox.information(self, "ERRO", u"Por favor, entre
>> > com o
>> > usuário e senha.", "OK")
>> > else:
>> > try: ############ If the login is made, the application is
>> > launch and the login screen is closed.
>> > p2db = Pro2db(str(user), str(passw))
>> > mainWnd = Pro2MainWindow()
>> > mainWnd.showMaximized()
>> > self.close()
>> > ###########################################
>> > except MySQLdb.Error, error_code:
>> > if error_code[0] == 1045:
>> > message = u"Acesso negado para o usuário: %s" %user
>> > elif error_code[0] == 2003:
>> > message = u"Não foi possível realizar a conexão."
>> > else:
>> > message = u"Erro desconhecido.\nCódigo
>> > administrativo:
>> > %s - %s." %(error_code[0], error_code[1])
>> > QMessageBox.information(self, "Falha no acesso", u"O
>> > servidor informa:\n%s" %message, "OK")
>> > ---------------------------
>> >
>> > Anyone can help?
>> >
>> > Thanks in advance,
>> > Sandro Dutra,
>> > Brazil.
>> >
>> > _______________________________________________
>> > PyQt mailing list PyQt at riverbankcomputing.com
>> > http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>> >
>
>
More information about the PyQt
mailing list