I am writing a program with python 3.3.3 and pyqt5. I have connected many signals and slots with no problem. This one is causing a problem. My code follows:
Excellent answers but just want to add this explanation:
Doing
vendorComboBox.currentTextChanged.connect(_vendorChanged(vendorComboBox, dictVendors, modelComboBox))
is the same as doing
obj = _vendorChanged(vendorComboBox, dictVendors, modelComboBox)
vendorComboBox.currentTextChanged.connect(obj)
Now you should see that obj
is not a function but the result of calling your _vendorChanged
function with the 3 parameters. This means that you get the impression that the signal is immediately fired, thereby calling your function, but in fact it's just your function executing as directed. The second problem is that _vendorChanged
does not return anything so obj is in fact None. Since you are trying to connect a signal to None, you get this error. The solution is given in other answers.