I know of two ways to achieve this, but neither is exactly what you suggested. You cannot actually pass the reference to the button as an argument to the slot, unfortunately.
1) This is fairly convoluted. Subclass the button class and create a method that calls choose_color. Then you can pass the button reference to choose_color. 2) This method is much simpler, and I believe the preferred way of doing this. There is a method QObject.sender which points to the object that sent the signal, i.e. the button. See http://doc.qt.nokia.com/stable/qobject.html#sender. Ben On Tue, Nov 1, 2011 at 12:46 PM, anatoly techtonik <techto...@gmail.com>wrote: > I have this script that is a simple Button that calls color selection > dialog and then shows this color in popup window. > > https://bitbucket.org/techtonik/pyside-copy-paste/src/19c2cd089141/04.dialog.color.py > > I define choose_color() function and assign it as a handler with: > button.clicked.connect(choose_color) > > Now I want choose_color() to paint the button itself with a given > color. How can I pass a reference to the button into choose_color()? > > -- > anatoly t. > _______________________________________________ > PySide mailing list > PySide@lists.pyside.org > http://lists.pyside.org/listinfo/pyside >
_______________________________________________ PySide mailing list PySide@lists.pyside.org http://lists.pyside.org/listinfo/pyside