[pygtk] Can I change a radio button's group?

skip at pobox.com skip at pobox.com
Fri Jun 9 04:43:31 WST 2006


I have a GtkWindow and children defined in glade that I instantiate multiple
times and place into a notebook.  One of the window's descendants is a radio
button.  I want all instances of that radio button across the different
windows to belong to the same group.  Unfortunately, glade insists that each
radio button be placed in a group, and rb.set_group() won't let me change
the group on-the-fly (after instantiating the window and its kids).  Is
there a way to accomplish this?  I also tried accumulating the radio buttons
into a list and then calling rb.set_property("group", the_list) for each
radio button, e.g:

    class SomeClass:
        group = []
        def __init__(self, ...):
            wtree = ...
            self.rb = wtree.get_widget(radio-'button')
            SomeClass.group.append(self.rb)
            self.rb.set_property("group", SomClass.group)

That fails as well:

    ...
    self.rb.set_property("group", SomeClass.group)
  TypeError: could not convert argument to correct param type

The PyGtk docs say the group property is writable.  What type should it be
to allow conversion the appropriate parameter type?

Is it even possible to change a radio button's group after it's been
created?

Thanks,

-- 
Skip Montanaro - skip at pobox.com - http://www.mojam.com/


More information about the pygtk mailing list