airton arantes schrieb:
> Hello folks, I did an application as example, the link to glade file
> and python source file are these:
> 
> http://paste.ubuntu-nl.org/43577/      this is the teste.glade
> http://paste.ubuntu-nl.org/43578/      this is the test.py
> 
> 
> I wanted the following:
> -> When I press OK button, instead of print "button ok pressed" I want
> that it print on the console "RadioButon1 was marked" or "RadioButton2
> was marked".

That's easy.

Change your function button_ok_callback().

Current you have

def button_ok_callback(*args):
        print "Button ok pressed"


If you change this to

def button_ok_callback(*args):
        if gladefile.get_widget("radiobutton1").get_active():
                print "RadioButton1 was marked"
        elif gladefile.get_widget("radiobutton2").get_active():
                print "RadioButton2 war marked"

The script prints this:

% python test.py
RadioButton1 was marked
RadioButton2 war marked
RadioButton2 war marked

As you know you can get a widget with get_widget(). The get_active()
method of the gtk.CheckButton() (the base class of gtk.RadioButton())
returns True if the button is checked, or False if the button isn't checked.

Best regards
Marcus
_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to