I noticed that querying a radio button (group) with
value = self.rb1.get_group_value()
works when the panel containing the radiobutton is visible, but returns None when the panel is not attached to the main form, ie not visible (but not deleted). This was unexpected, because all other fields retain their value.
workaround:
for rb in [self.rb1, self.rb2, self.rb3]:
if rb.selected:
return rb.value
I have a main form that has references to several panels. The panel are added/removed as a component to the main form as required. So the panels are constructed once, but not always “attached” to the main form as a component.
Nothing fancy, similar to lots of demo apps.
Then I have a method that switches the active panel:
def select_panel(self, name):
self.content_panel.clear()
if not self.is_logged_in():
name = 'start'
self.content_panel.add_component(self.panels[name])