Hi guys I'm really a newbie of python and pygtk, so sorry if my question is... too dumb (o:
I'm tring to understand how to set a value to a variable, with check buttons. I will post here what I'm doing...or better...tring to do. when I check the button I would like that the variable a will be set as 3 and when is unchecked to 4, this of course doesn't work, when I press the other button to see the results I will get as output always the number 2, as set at the beginning. #!/usr/bin/env python import gtk a=2 class try: def callback(self, widget, data=None): a = "%s" % ((3, 4)[widget.get_active()]) def call1(self, widget, data=None): print a def delete_event(self, widget, event, data=None): gtk.main_quit() return gtk.FALSE def __init__(self): self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.window.set_title("Check Button") self.window.connect("delete_event", self.delete_event) self.window.set_border_width(20) table = gtk.Table(2, 2, gtk.TRUE) self.window.add(table) button = gtk.CheckButton("check button 1") button.connect("toggled", self.callback, "check button 1") table.attach(button, 1, 2, 0, 1) button.show() button=gtk.Button("press to try") button.connect("clicked", self.call1, "cool button") table.attach(button, 0, 1, 0, 1) button.show() table.show() self.window.show() def main(): gtk.main() return 0 if __name__ =="__main__": try() main() Can someone try to explain to me how it works thanks a lot in advance Mario aka Liquid _______________________________________________ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/