On Tue Sep 29 02:47:11 BST 2009, pantheon wrote: > I am creating <QAction> in a loop and adding it to menu. > > action = QtGui.QAction(QtGui.QIcon(iconFile), fileName, menu) > menu.addAction(action) > > I need to connect this action to a python function in such a way that I > should get <text> of QAction or instance of QAction object itself.
Connect its triggered() signal to a slot where you call sender() to obtain the action object. New-style connection syntax: action.triggered.connect(handleAction) Then you can obtain the text from the action object: def handleAction(self): text = sender().text() David _______________________________________________ PyQt mailing list PyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt