]> git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/SingleChoiceDialog.py
Merge the cell size attribute the same way that other attributes are
[wxWidgets.git] / wxPython / demo / SingleChoiceDialog.py
1
2 import wx
3
4 #---------------------------------------------------------------------------
5
6 class 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
32 def runTest(frame, nb, log):
33 win = TestPanel(nb, log)
34 return win
35 #---------------------------------------------------------------------------
36
37
38
39
40 overview = """\
41 This class represents a dialog that shows a list of strings, and allows the user
42 to select one. Double-clicking on a list item is equivalent to single-clicking
43 and then pressing OK.
44
45 As with all dialogs, be sure to retrieve the information you need BEFORE you
46 destroy the dialog.
47 """
48
49
50
51 if __name__ == '__main__':
52 import sys,os
53 import run
54 run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])
55