]> git.saurik.com Git - wxWidgets.git/blame - wxPython/demo/SingleChoiceDialog.py
'[1219035] cleanup: miscellaneous' and minor source cleaning.
[wxWidgets.git] / wxPython / demo / SingleChoiceDialog.py
CommitLineData
cf694132 1
8fa876ca 2import wx
cf694132
RD
3
4#---------------------------------------------------------------------------
5
34a544a6
RD
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())
8fa876ca 24
34a544a6 25 dlg.Destroy()
8fa876ca 26
cf694132 27
34a544a6
RD
28
29#---------------------------------------------------------------------------
30
31
32def runTest(frame, nb, log):
33 win = TestPanel(nb, log)
34 return win
cf694132
RD
35#---------------------------------------------------------------------------
36
37
38
39
1fded56b
RD
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.
cf694132 44
8fa876ca
RD
45As with all dialogs, be sure to retrieve the information you need BEFORE you
46destroy the dialog.
1fded56b 47"""
cf694132
RD
48
49
50
1fded56b
RD
51if __name__ == '__main__':
52 import sys,os
53 import run
8eca4fef 54 run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])
493f1553 55