pyGTK identify a button

Tracubik affdfsdfdsfsd at b.com
Wed May 25 04:18:48 EDT 2011


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



More information about the Python-list mailing list