]> git.saurik.com Git - wxWidgets.git/blame - wxPython/demo/wxChoice.py
focus setting must be possible even when not shown yet
[wxWidgets.git] / wxPython / demo / wxChoice.py
CommitLineData
cf694132
RD
1
2from wxPython.wx import *
3
4#---------------------------------------------------------------------------
5
6class TestChoice(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 wxChoice control.",
15 wxPoint(15, 10))
16
17 wxStaticText(self, -1, "Select one:", wxPoint(15, 50), wxSize(75, 20))
8577c05a 18 self.ch = wxChoice(self, 40, (80, 50), choices = sampleList)
cf694132
RD
19 EVT_CHOICE(self, 40, self.EvtChoice)
20
d56cebe7 21
cf694132
RD
22 def EvtChoice(self, event):
23 self.log.WriteText('EvtChoice: %s\n' % event.GetString())
d56cebe7
RD
24 self.ch.Append("A new item")
25
cf694132
RD
26
27#---------------------------------------------------------------------------
28
29def runTest(frame, nb, log):
30 win = TestChoice(nb, log)
31 return win
32
33#---------------------------------------------------------------------------
34
35
36
37
38
39
40
41
42
43
44
45
46overview = """\
47A choice item is used to select one of a list of strings. Unlike a listbox, only the selection is visible until the user pulls down the menu of choices.
cf694132 48"""
1fded56b
RD
49
50
51
52
53
54if __name__ == '__main__':
55 import sys,os
56 import run
57 run.main(['', os.path.basename(sys.argv[0])])
58