[WX] wxRadioBox and change choice

M

Michele Petrazzo

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?

Thanks,
Michele Petrazzo
 
P

Peter Hansen

Michele said:
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.

-Peter
 
M

Michele Petrazzo

Peter said:
Michele said:
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.
I read the documentation of RadioBox about 10-15 times, but I don't see
this option. I need a coffee. :)

Thanks,
Michele
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top