Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #6208

pyGTK identify a button

Date 2011-05-25 10:18 +0200
From Tracubik <affdfsdfdsfsd@b.com>
Newsgroups comp.lang.python
Subject pyGTK identify a button
Message-ID <4ddcbb68$0$18241$4fafbaef@reader2.news.tin.it> (permalink)
Organization TIN.IT (http://www.tin.it)

Show all headers | View raw


Hi all,
i'm trying to write a simple windows with two button in GTK, i need a 
way to identify wich button is pressed.
Consider that:

the two button are connected (when clicked) to infoButton(self, widget, 
data=None)

infoButton() is something like this

infoButton(self, widget, data=None):
	# discover wich button was pressed
	...
	# say hello to the button
	if button1pressed:
		print "Hi, button1!"
	else:
		print "Hi, button2!"

so, how can I know wich button was pressed without using data and 
without reading the label of the button (i could have buttons with the 
same label)

If data is needed, can someone pls tell me how to set it properly in 
glade 3.8

thanks
Nico

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


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