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


Groups > comp.lang.python > #6208

pyGTK identify a button

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!feeder.news.tin.it!spool.news.tin.it!not-for-mail
Date Wed, 25 May 2011 10:18:48 +0200
From Tracubik <affdfsdfdsfsd@b.com>
User-Agent Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110503 Thunderbird/3.1.10
MIME-Version 1.0
Newsgroups comp.lang.python
Subject pyGTK identify a button
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
Lines 28
Message-ID <4ddcbb68$0$18241$4fafbaef@reader2.news.tin.it> (permalink)
Organization TIN.IT (http://www.tin.it)
X-Comments Please send technical notifications to newsmaster@tin.it
NNTP-Posting-Host 79.2.166.66
X-Trace 1306311528 reader2.news.tin.it 18241 79.2.166.66:9614
X-Complaints-To Please send abuse reports to abuse@retail.telecomitalia.it
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:6208

Show key headers only | 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