Re: pyGTK identify a button

the two button are connected (when clicked) to infoButton(self,

From documentation:
handler_id = object.connect(name, func, func_data)


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!"
print "Hi, button2!"

Claudiu Nicolaie CISMARU
T: +40 755 135455
E: claudiu@xxxxxxxxxxxxxxx, claudiu.cismaru@xxxxxxxxx

Attachment: signature.asc
Description: This is a digitally signed message part.

Relevant Pages

  • Re: pyGTK identify a button
    ... way to identify wich button is pressed. ... the two button are connected to infoButton(self, widget, ... print "Hi, button1!" ... without reading the label of the button (i could have buttons with the ...
  • Re: pyGTK identify a button
    ... On 25/05/2011 10:44, Claudiu Nicolaie CISMARU wrote: ... handler_id = object.connect(name, func, func_data) ... know how to set it on glade3.8, that is the program i use to create the GUI. ...