Changing wxChoice selections

Is there a way to change the string list (selections) of wxChoice once
it is created ??

I checked the wx online docs and noted there was a GetStrings() method
in one of the base classes that appears to return the current list, but
there is no equivalent SetStrings() method.

Thanks, Brendan.

Hello,

···

On Thu, Jun 25, 2009 at 8:24 AM, Brendan Simon (eTRIX)<Brendan.Simon@etrix.com.au> wrote:

Is there a way to change the string list (selections) of wxChoice once
it is created ??

I checked the wx online docs and noted there was a GetStrings() method
in one of the base classes that appears to return the current list, but
there is no equivalent SetStrings() method.

Api is a little inconsistent here,

wx.Choice.SetItems(['list', 'of', 'strings'])

Cody

I changed my google inputs and found a solution.

Either:
    choice.Clear()
    choice.AppendItems( newList )
    choice.SetSelection(0)
or
    choice.SetItems( newList )
    choice.SetSelection(0)

I presume that Clear() is not required when calling SetItems(). i.e. it
is implicit.

Brendan Simon (eTRIX) wrote:

···

Is there a way to change the string list (selections) of wxChoice once
it is created ??

I checked the wx online docs and noted there was a GetStrings() method
in one of the base classes that appears to return the current list, but
there is no equivalent SetStrings() method.

Thanks, Brendan.

Hello,

···

On Thu, Jun 25, 2009 at 8:37 AM, Brendan Simon (eTRIX)<Brendan.Simon@etrix.com.au> wrote:

I changed my google inputs and found a solution.

Either:
choice.Clear()
choice.AppendItems( newList )
choice.SetSelection(0)
or
choice.SetItems( newList )
choice.SetSelection(0)

I presume that Clear() is not required when calling SetItems(). i.e. it
is implicit.

Yes SetItems is simply defined as,

def SetItems(self, items):
     """Clear and set the strings in the control from a list"""
     self.Clear()
     self.AppendItems(items)

Cody