[wxPython] wxChoice and wxComboBox - SetList?

I have an application where I regularly have to replace the options in a
choice control. (I'm using wxPython 2.2)

You can initially just give a list to the construction of the control,
but this doesn't seem to be available for update. It seems really
clunky to me to have to do:

    ctrl.Clear()
    for elem in list_of_stuff:
        ctrl.Append(elem)

just to replace the list. Has anyone considered adding:

  ctrl.SetList(list_of_stuff)

to the wxPython wrappers for wxChoice and wxComboBox?

(Or has this already been done, and it's just not in the
documentation (at least that I can find, anyway...)?)

It would also be good if you could call .GetList(), and get a
reference to the underlying list so that if you modified it, it would
update the control, but that may be too much to hope for... :slight_smile:

Respectfully,
Will Sadkin

just to replace the list. Has anyone considered adding:

ctrl.SetList(list_of_stuff)

to the wxPython wrappers for wxChoice and wxComboBox?

There's AppendItems in wxControlWithItems, but unfortunately wxGTK's
wxComboBox doesn't derive from wxChoice so it doesn't inherit that method.
It should work on the other platforms though.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!