X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/299647acac7960652aadb008775429c1f8ea9b8d..d0ee33f5c6908b4ac5e1364381f0ef00942e3936:/wxPython/demo/ComboBox.py diff --git a/wxPython/demo/ComboBox.py b/wxPython/demo/ComboBox.py index eb995d51a5..4ab15a6467 100644 --- a/wxPython/demo/ComboBox.py +++ b/wxPython/demo/ComboBox.py @@ -1,7 +1,3 @@ -# 11/15/2003 - Jeff Grimmett (grimmtooth@softhome.net) -# -# o Updated for wx namespace -# import wx @@ -24,7 +20,7 @@ class TestComboBox(wx.Panel): #'this is a long item that needs a scrollbar...', 'six', 'seven', 'eight'] - wx.StaticText(self, -1, "This example uses the wxComboBox control.", (8, 10)) + wx.StaticText(self, -1, "This example uses the wx.ComboBox control.", (8, 10)) wx.StaticText(self, -1, "Select one:", (15, 50), (75, 18)) # This combobox is created with a preset list of values. @@ -33,23 +29,18 @@ class TestComboBox(wx.Panel): (95, -1), sampleList, wx.CB_DROPDOWN #|wxTE_PROCESS_ENTER ) - ##import win32api, win32con - ##win32api.SendMessage(cb.GetHandle(), - ## win32con.CB_SETHORIZONTALEXTENT, - ## 200, 0) - self.Bind(wx.EVT_COMBOBOX, self.EvtComboBox, cb) self.Bind(wx.EVT_TEXT, self.EvtText, cb) self.Bind(wx.EVT_TEXT_ENTER, self.EvtTextEnter, cb) cb.Bind(wx.EVT_SET_FOCUS, self.OnSetFocus) cb.Bind(wx.EVT_KILL_FOCUS, self.OnKillFocus) - # Once the combobox is set up, we append some more data to it. + # Once the combobox is set up, we can append some more data to it. cb.Append("foo", "This is some client data for this item") # This combobox is created with no values initially. cb = wx.ComboBox( - self, 501, "default value", (90, 80), (95, -1), [], wx.CB_SIMPLE) + self, 501, "default value", (90, 80), (95, -1), [], wx.CB_DROPDOWN) # Here we dynamically add our values to the second combobox. for item in sampleList: @@ -58,7 +49,7 @@ class TestComboBox(wx.Panel): self.Bind(wx.EVT_COMBOBOX, self.EvtComboBox, cb) self.Bind(wx.EVT_COMBOBOX, self.EvtText, cb) - # The user selects something, we go here. + # When the user selects something, we go here. def EvtComboBox(self, evt): cb = evt.GetEventObject() data = cb.GetClientData(cb.GetSelection()) @@ -85,7 +76,6 @@ def runTest(frame, nb, log): #--------------------------------------------------------------------------- - overview = """\ A ComboBox is like a combination of an edit control and a listbox. It can be displayed as static list with editable or read-only text field; or a drop-down @@ -108,8 +98,10 @@ event is generated every time that the user hits a key in the ComboBox entry fie """ +#--------------------------------------------------------------------------- + if __name__ == '__main__': import sys,os import run - run.main(['', os.path.basename(sys.argv[0])]) + run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])