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