]> git.saurik.com Git - wxWidgets.git/blame_incremental - wxPython/demo/SingleChoiceDialog.py
Another package name fix
[wxWidgets.git] / wxPython / demo / SingleChoiceDialog.py
... / ...
CommitLineData
1
2import wx
3
4#---------------------------------------------------------------------------
5
6class TestPanel(wx.Panel):
7 def __init__(self, parent, log):
8 self.log = log
9 wx.Panel.__init__(self, parent, -1)
10
11 b = wx.Button(self, -1, "Create and Show a SingleChoiceDialog", (50,50))
12 self.Bind(wx.EVT_BUTTON, self.OnButton, b)
13
14
15 def OnButton(self, evt):
16 dlg = wx.SingleChoiceDialog(
17 self, 'Test Single Choice', 'The Caption',
18 ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight'],
19 wx.CHOICEDLG_STYLE
20 )
21
22 if dlg.ShowModal() == wx.ID_OK:
23 self.log.WriteText('You selected: %s\n' % dlg.GetStringSelection())
24
25 dlg.Destroy()
26
27
28
29#---------------------------------------------------------------------------
30
31
32def runTest(frame, nb, log):
33 win = TestPanel(nb, log)
34 return win
35#---------------------------------------------------------------------------
36
37
38
39
40overview = """\
41This class represents a dialog that shows a list of strings, and allows the user
42to select one. Double-clicking on a list item is equivalent to single-clicking
43and then pressing OK.
44
45As with all dialogs, be sure to retrieve the information you need BEFORE you
46destroy the dialog.
47"""
48
49
50
51if __name__ == '__main__':
52 import sys,os
53 import run
54 run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])
55