pyGTK identify a button
Claudiu Nicolaie CISMARU
claudiu at virtuamagic.com
Wed May 25 04:44:12 EDT 2011
> the two button are connected (when clicked) to infoButton(self,
> widget,
> data=None)
From documentation:
handler_id = object.connect(name, func, func_data)
So:
button1.connect(when is pressed, your_function, 1)
button2.connect(when is pressed, your_function, 2)
(This code is conception, I don't really know how is done in GTK).
On the callback:
infoButton(self, widget, data=None):
# discover wich button was pressed
...
# say hello to the button
if data == 1:
print "Hi, button1!"
else:
print "Hi, button2!"
--
Claudiu Nicolaie CISMARU
GNU GPG Key: http://claudiu.targujiu.net/key.gpg
T: +40 755 135455
E: claudiu at virtuamagic.com, claudiu.cismaru at gmail.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.python.org/pipermail/python-list/attachments/20110525/e152947f/attachment-0001.sig>
More information about the Python-list
mailing list