update Choice values at runtime

I think this has been asked before, ..

Hmm, i found no post related to a similar topic.

like a "SetChoices()" option. So the way to go is, I think, make the list
of choices when your program starts (from wherever you're taking it), and
create the choice new at that time. If it changes while the user is using it,
you can destroy and recreate it with the new choices. As you see below,
the choices are provided when it is created:

self.choices = ["item 1", "item 2", "item 3"]

self.choice1 = wx.Choice(choices=self.choices, id=-1,
              name='choice1', parent=self.panel1, pos=wx.Point(0, 0),
              size=wx.Size(130, 21), style=0)

Ok, that would be an option. But i use an interface-builder like
wxglade. So i have to keep this part of code untouched if i can, otherwise i am
overriding some code.

I found an other solution that solves my issue

  output_formats = [ 'a', 'b', 'c'] #the list came from an cli output
        output_formats.reverse()
        for i in output_formats:
            self.output_format_choice.Insert(i, 0)

i put this into an method an call it after the choice is initialised.

@Pat:

import wx
w = wx.Choice(shell)

Traceback (most recent call last):
  File "<stdin>", line 1, in ?
NameError: name 'shell' is not defined

Thank you for you help!

best regards

Stefan Pampel

···

On 2007-11-13, C M <cmpython@gmail.com> wrote:
--
/ polyformal /

http://www.polyformal.de /
_________________________/

GPG KEY: 11678845

And again i've learnt something new.

In debian i have to do:

aptitude install python-wxtools

thx

Stefan Pampel

···

On 2007-11-13, Patrick K. O'Brien <pobrien@orbtech.com> wrote:

You have to be in PyCrust or PyShell for that to work. Or some other

--
/ polyformal /

http://www.polyformal.de /
_________________________/

GPG KEY: 11678845