Am Mittwoch, 13. Februar 2013, 00:40:04 schrieb Alex Naumov:
Hi,
I'm trying to connect widget with my own method. Using such implementation I get success:
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))
There's a new style signals and slots system, we use nowadays: self.action_wired.triggered.connect(lambda: self.wired(interface)) Much easier to write and to read.. http://pyqt.sourceforge.net/Docs/PyQt4/new_style_signals_slots.html Cheers, Pete -- To unsubscribe, e-mail: opensuse-programming+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-programming+owner@opensuse.org