airton arantes schrieb: > thank you very much Marcus, but where you saw the get_active() method? > is there at pygtk's reference?
For sure. :-) I don't know what distribution do you use (if you use linux). If you are using Linux have a look into /usr/share/gtk-doc/html/pygtk. If this directory exists open the index.html file located in it. Maybe your distribution provides a package calling pygtk-doc or something similar. You can find more informations about pygtk on http://www.pygtk.org/. On this site you can find a link to the pygtk reference and to a very useful FAQ about some hints and tricks for pygtk. Best regards Marcus > > On Nov 6, 2007 5:05 PM, Marcus Habermehl <[EMAIL PROTECTED]> wrote: >> 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/ >> > > > _______________________________________________ pygtk mailing list [email protected] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
