Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #6210
| From | Claudiu Nicolaie CISMARU <claudiu@virtuamagic.com> |
|---|---|
| Organization | virtuaMAGIC |
| Subject | Re: pyGTK identify a button |
| Date | 2011-05-25 11:44 +0300 |
| References | <4ddcbb68$0$18241$4fafbaef@reader2.news.tin.it> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2059.1306313058.9059.python-list@python.org> (permalink) |
[Multipart message — attachments visible in raw view] - view raw
> 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@virtuamagic.com, claudiu.cismaru@gmail.com
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
pyGTK identify a button Tracubik <affdfsdfdsfsd@b.com> - 2011-05-25 10:18 +0200
Re: pyGTK identify a button Claudiu Nicolaie CISMARU <claudiu@virtuamagic.com> - 2011-05-25 11:44 +0300
Re: pyGTK identify a button Tracubik <affdfsdfdsfsd@b.com> - 2011-05-25 10:51 +0200
Re: pyGTK identify a button Claudiu Nicolaie CISMARU <claudiu@virtuamagic.com> - 2011-05-25 12:19 +0300
Re: pyGTK identify a button Chris Angelico <rosuav@gmail.com> - 2011-05-25 18:58 +1000
Re: pyGTK identify a button Cousin Stanley <cousinstanley@gmail.com> - 2011-05-25 16:22 +0000
Re: pyGTK identify a button Alister Ware <alister.ware@ntlworld.com> - 2011-05-26 17:50 +0000
csiph-web