Reputation: 55
My problem is that, when I put a Qaction triggered in pyqt to open a QDialog, I used to do with lambda functions (to pass parameters), but when I test the GUI, I opened for a first time the dialog, but, when I opened for a second time, the shell throws me this error
Traceback (most recent call last):
File "C:\path\to\file\launcher.py", line 51, in <lambda>
self.ui.actionIngresar_Licencia.triggered.connect(lambda: self.Dlg_IngresarLicencia())
TypeError: 'Ui_dialogoLicencia' object is not callable
Ok, you can say me that I don pass any parameter, but if this error appears when I need to pass parameters, It will be so bad. When I put the function without lambda function, the gui works perfectly Here's the function with the dialog.
def Dlg_IngresarLicencia(self):
self.Dlg_IngresarLicencia = Ui_dialogoLicencia()
self.dialogo = QtGui.QDialog(parent=None)
self.Dlg_IngresarLicencia.setupUi(self.dialogo)
self.Dlg_IngresarLicencia.btn_ObtenerLicencia.clicked.connect(lambda: Componentes().clickObtenerLicencia())
self.dialogo.show()
Thanks guys, I hope you can help me
Upvotes: 0
Views: 223
Reputation: 11939
Your method is called the same as the attribute you're setting:
def Dlg_IngresarLicencia(self):
self.Dlg_IngresarLicencia = Ui_dialogoLicencia()
Because of that, after the first call you override the method with a Ui_dialogoLicencia
instance, which is not callable.
Upvotes: 1