[pygtk] How do I set radio buttons from a program
pjr at itee.uq.edu.au
Fri Apr 13 05:42:29 WST 2007
John Dennis wrote:
> On Thu, 2007-04-12 at 10:29 +1000, Peter Robinson wrote:
>> I am writing a simple applet whose button3 menu contains a list of radio
>> When the applet starts up I want to be able to run a test and base the
>> radio button settings on the result of the test.
>> I have spend many hours looking at tutorials, manuals and google'ing for
>> an answer to my problem without any luck.
>> Any suggestions?
> Note, this will cause the 'toggled' signal to be emitted for both the
> button being unset and the the button being set. You should have a
> toggled signal handler shared with each button in the group, then test
> for whether the button in question is active, e.g.
> def radio_changed(self, radiobutton, choice):
> if radiobutton.get_active():
> # choice is the new button selected in the radio group
> # choice was unset, mostly you don't have to handle this
> Note: choice is the user_data you pass in when you connect the toggled
> signal to the button.
Thanks for that suggestion - the other problem I am having is being able
to get at the button.
I have used
popup = self.applet.get_popup_component()
where the radio buttons are defined in xml_menu.
More information about the pygtk