On Dec 21, 11:15 am, "John Posner" <jjpos...@optimum.net> wrote: > On Sun, 20 Dec 2009 16:59:11 -0500, Zabin <zabin.faris...@gmail.com> wrote: > > I am beginner in programming in pyqt. I have been trying to call the > > same function from multiple events- but each event results in a > > different instance of the function. I am just unable to figure out how > > to retrieve the source which calls the function: > > > My source signal declarations are as below: > > QtCore.QObject.connect(self.ui.Button_Process, QtCore.SIGNAL("clicked > > ()"), self.activate_tab) > > QtCore.QObject.connect(self.ui.Button_Material, QtCore.SIGNAL("clicked > > ()"), self.activate_tab) > > QtCore.QObject.connect(self.ui.Button_Geometry, QtCore.SIGNAL("clicked > > ()"), self.activate_tab) > > > for each of the above source i want to activate a different instance > > of the activate_tab function. Any help would be greatly appreciated! > > In the self.activate_tab() method, use self.sender() to determine which > object sent the signal. > > -John- Hide quoted text - > > - Show quoted text -
Awesum. That works! To get the object name you just need to use self.sender().objectName() Cheers! -- http://mail.python.org/mailman/listinfo/python-list