[PyKDE] "sender" info in Python slot
Mathieu Leclaire
mleclaire at grignon.inra.fr
Thu Nov 9 16:55:48 GMT 2006
You can get the emitting button with the sender() function from the
QObject class
Sibylle Koczian a écrit :
> Hello,
>
> hopefully the subject line isn't too misleading. This is my problem: I would like to connect the "clicked" signal of several buttons to one and the same function - but this function should know which button sent the signal. Example: one button to increase a value, another to decrease it, and one single function which adds '+1' or '-1' depending on the sending button. Or a row of buttons with a letter, and clicking one searches for all words beginning with this letter in a list.
>
> How can I do this? Subclassing QPushButton seems to be a possibility, but is there a simpler way?
>
> Using PyQt 4 with Python 2.4.
>
> Thank you,
> Koczian
>
>
--
Mathieu Leclaire
Ingénieur recherche
INRA
Unité Eco-Innov
BP01
78850 Thiverval Grignon
Tel : 01-30-81-52-08
More information about the PyQt
mailing list