I need help in understanding how to add an additional entry to a wxChoice
dropdown list box. The wxWindows doc shows:
void Append(const wxString& item)
Adds the item to the end of the choice control.
So in python, would I use something like:
wxchoicename.Append("ABC123")
That is what I'm doing and I don't get an error but the new value isn't
being appended either.
Works for me. I changed the wxChoice.py in the demo like below and
everytime I select an item a new one is added to the drop down. Which
platform are you on?
class TestChoice(wxPanel):
def __init__(self, parent, log):
self.log = log
wxPanel.__init__(self, parent, -1)
sampleList = ['zero', 'one', 'two', 'three', 'four', 'five',
'six', 'seven', 'eight']
wxStaticText(self, -1, "This example uses the wxChoice control.",
wxPoint(15, 10))
wxStaticText(self, -1, "Select one:", wxPoint(15, 50), wxSize(75,
20))
self.ch = wxChoice(self, 40, (80, 50), (95, 125),
choices = sampleList)
EVT_CHOICE(self, 40, self.EvtChoice)
def EvtChoice(self, event):
self.log.WriteText('EvtChoice: %s\n' % event.GetString())
self.ch.Append("A new item")
···
--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!