NOTE: This appears to be an OSX specific problem.
The code below demonstrates the problem I am running into. I am creating a wx.ComboBox and trying to mimic it's functionality for testing purposes by posting a wxEVT_COMMAND_COMBOBOX_SELECTED event... this event strangely works fine for wx.Choice, but it doesn't do anything to the ComboBox.
There doesn't appear to be a different event that I can post to the combobox, but maybe I'm missing something.
I'm running this code on Python 2.5 on a Mac OSX 10.5.8
import wx
app = wx.PySimpleApp()
def on_btn(evt):
event = wx.CommandEvent(wx.wxEVT_COMMAND_COMBOBOX_SELECTED,combobox.Id)
event.SetEventObject(combobox)
event.SetInt(1)
event.SetString('bar')
combobox.Command(event)
app.ProcessPendingEvents()
frame = wx.Frame(None)
panel = wx.Panel(frame, -1)
# This doesn't work
combobox = wx.ComboBox(panel, -1, choices=['foo','bar'])
# This works
#combobox = wx.Choice(panel, -1, choices=['foo','bar'])
combobox.SetSelection(0)
btn = wx.Button(panel, -1, 'asdf')
btn.Bind(wx.EVT_BUTTON, on_btn)
sz = wx.BoxSizer()
sz.Add(combobox)
sz.Add(btn)
panel.SetSizer(sz)
frame.Show()
app.MainLoop()
UPDATE: I hooked up the combobox to a handler of wx.EVT_COMBOBOX to see what event type is being caught there and I got the id 10016 which matches wxEVT_COMMAND_COMBOBOX_SELECTED... so generating this command event certainly SHOULD cause the ComboBox to update.