]> git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/MultipleChoiceDialog.py
non-PCH build fix (according to Tinderbox).
[wxWidgets.git] / wxPython / demo / MultipleChoiceDialog.py
1
2 import wx
3 import wx.lib.dialogs
4
5 #---------------------------------------------------------------------------
6
7 class TestPanel(wx.Panel):
8 def __init__(self, parent, log):
9 self.log = log
10 wx.Panel.__init__(self, parent, -1)
11
12 b = wx.Button(self, -1, "Create and Show a MultipleChoiceDialog", (50,50))
13 self.Bind(wx.EVT_BUTTON, self.OnButton, b)
14
15
16 def OnButton(self, evt):
17 lst = [ 'apple', 'pear', 'banana', 'coconut', 'orange', 'grape', 'pineapple',
18 'blueberry', 'raspberry', 'blackberry', 'snozzleberry',
19 'etc', 'etc..', 'etc...' ]
20
21 dlg = wx.lib.dialogs.MultipleChoiceDialog(
22 self,
23 "Pick some from\n this list\nblah blah...",
24 "m.s.d.", lst)
25
26 if (dlg.ShowModal() == wx.ID_OK):
27 self.log.write("Selection: %s -> %s\n" % (dlg.GetValue(), dlg.GetValueString()))
28
29 dlg.Destroy()
30
31
32
33 #---------------------------------------------------------------------------
34
35 def runTest(frame, nb, log):
36 win = TestPanel(nb, log)
37 return win
38
39 #---------------------------------------------------------------------------
40
41
42
43 overview = """\
44 <html>
45 <body>
46
47 This is a Python implementation of a dialog that is not yet implemented in wxWindows
48 proper, so don't let the wxWindows documentation mislead you.
49
50 <p><code><b>MultipleChoiceDialog</b>(self, parent, msg, title, lst,
51 pos = wx.wxDefaultPosition, size = (200,200), style = wx.DEFAULT_DIALOG_STYLE)
52 </code>
53
54 <dl>
55 <dt><code>parent</code>
56 <dd>The parent window
57
58 <dt><code>msg</code>
59 <dd>The message that will be displayed above the list
60
61 <dt><code>title</code>
62 <dd>The text that will appear on the title bar
63
64 <dt><code>lst</code>
65 <dd>A Python list of choices that will appear in the dialog.
66
67 <dt><code>pos</code>
68 <dd>The position of the dialog
69
70 <dt><code>size</code>
71 <dd>The size of the dialog
72
73 <dt><code>style</code>
74 <dd>The style for the dialog. Only styles normally available to wxDialog are
75 available.
76
77 </dl>
78
79 <b><font size=+1><code>Methods</code></font></b>
80
81 <dl>
82 <dt><code>GetValue</code>
83 <dd>Returns a tuple containing the indices of the selected items
84
85 <dt><code>GetValueString</code>
86 <dd>Returns a tuple containing the text of the selected items
87
88 </dl>
89
90 Additionally, MultipleChoiceDialog.lbox is a standard wx.ListBox which supports all
91 methods applicable to that class.
92
93 </body>
94 </html>
95 """
96
97 if __name__ == '__main__':
98 import sys,os
99 import run
100 run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])