On 2013-02-13 00:40:04 +0100, Alex Naumov wrote:
self.action_wired = QAction(QIcon("images/wired.png"), Interface, self) self.trayMenu.addAction(self.action_wired) self.connect(self.action_wired, SIGNAL("triggered()"), self.wired) ... def wired(self): print hello
but I want to call "self.wired" with parameter/argument. Such call is failed: self.connect(self.action_wired, SIGNAL("triggered()"), self.wired(Interface))
self.wired(Interface) is a method call which returns None which is passed as the third argument to the connect method. Something like this should work: self.connect(self.action_wired, SIGNAL("triggered()"), lambda: self.wired(Interface))
TypeError: arguments did not match any overloaded call: QObject.connect(QObject, SIGNAL(), QObject, SLOT(), Qt.ConnectionType=Qt.AutoConnection): argument 3 has unexpected type 'NoneType' QObject.connect(QObject, SIGNAL(), callable, Qt.ConnectionType=Qt.AutoConnection): argument 3 has unexpected type 'NoneType' QObject.connect(QObject, SIGNAL(), SLOT(), Qt.ConnectionType=Qt.AutoConnection): argument 3 has unexpected type 'NoneType'
Method "wired" should get information about interface:
def wired(self, Interface): print Interface
So, the question is pretty easy: how to call method via "connect" with argument? Is it really possible?
I've never used pyqt so I don't know if there's a better/more elegant way...
Using such call, but not as one of connect's parameters, it works well: self.wired(Interface).
Marcus -- To unsubscribe, e-mail: opensuse-programming+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-programming+owner@opensuse.org