]> git.saurik.com Git - wxWidgets.git/blame - wxPython/demo/wxComboBox.py
draw the selected items in another colour when the control doesn't have focus, a...
[wxWidgets.git] / wxPython / demo / wxComboBox.py
CommitLineData
cf694132
RD
1
2from wxPython.wx import *
3
4#---------------------------------------------------------------------------
5
6class TestComboBox(wxPanel):
7 def __init__(self, parent, log):
8 self.log = log
9 wxPanel.__init__(self, parent, -1)
10
11 sampleList = ['zero', 'one', 'two', 'three', 'four', 'five',
12 'six', 'seven', 'eight']
13
14 wxStaticText(self, -1, "This example uses the wxComboBox control.",
15 wxPoint(8, 10))
16
17 wxStaticText(self, -1, "Select one:", wxPoint(15, 50), wxSize(75, 18))
f581a26d 18 wxComboBox(self, 500, "default value", wxPoint(80, 50), wxSize(95, -1),
cf694132 19 sampleList, wxCB_DROPDOWN)
8bf5d46e 20 EVT_COMBOBOX(self, 500, self.EvtComboBox)
f6bcfd97 21 EVT_TEXT(self, 500, self.EvtText)
cf694132
RD
22
23
24 def EvtComboBox(self, event):
25 self.log.WriteText('EvtComboBox: %s\n' % event.GetString())
26
f6bcfd97
BP
27 def EvtText(self, event):
28 self.log.WriteText('EvtText: %s\n' % event.GetString())
29
cf694132
RD
30#---------------------------------------------------------------------------
31
32def runTest(frame, nb, log):
33 win = TestComboBox(nb, log)
34 return win
35
36#---------------------------------------------------------------------------
37
38
39
40
41
42
43
44
45
46
47
48
49overview = """\
50A 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 list with text field; or a drop-down list without a text field.
51
cf694132 52"""