[WX] wxRadioBox and change choice

Peter Hansen peter at engcorp.com
Tue Sep 14 13:34:51 CEST 2004

Michele Petrazzo wrote:
> I create a widget like this:
> self.rb_method = wxRadioBox(choices=['choice1', 'choice2'], id=-1,
>  label='Method', name='rb_method', parent=self, point=wxPoint(8, 320),
>  size=wxSize(168, 72), style=wxRA_SPECIFY_COLS,)
> I want to change choice (the choice' labels) in runtime use, so in my 
> code, choice1 -> test1, choice2 -> test2
> The wxRadioBox have Setlabel method, but it only change the "title", not 
> the choices.
> Is it possible to do it? Or I must destroy and recreate the widget?

The documentation (specifically the wxWindows reference) says this
under SetLabel, which in C/C++ is overloaded to allow this:

wxPython note: In place of a single overloaded method name, wxPython 
implements the following methods:

  SetLabel(string)  Sets the radiobox label.
  SetItemLabel(n, string)  Sets a label for a radio button.


More information about the Python-list mailing list