]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/MultipleChoiceDialog.py
5 #---------------------------------------------------------------------------
7 class TestPanel(wx
.Panel
):
8 def __init__(self
, parent
, log
):
10 wx
.Panel
.__init
__(self
, parent
, -1)
12 b
= wx
.Button(self
, -1, "Create and Show a MultipleChoiceDialog", (50,50))
13 self
.Bind(wx
.EVT_BUTTON
, self
.OnButton
, b
)
16 def OnButton(self
, evt
):
17 lst
= [ 'apple', 'pear', 'banana', 'coconut', 'orange', 'grape', 'pineapple',
18 'blueberry', 'raspberry', 'blackberry', 'snozzleberry',
19 'etc', 'etc..', 'etc...' ]
21 dlg
= wx
.lib
.dialogs
.MultipleChoiceDialog(
23 "Pick some from\n this list\nblah blah...",
26 if (dlg
.ShowModal() == wx
.ID_OK
):
27 self
.log
.write("Selection: %s -> %s\n" % (dlg
.GetValue(), dlg
.GetValueString()))
33 #---------------------------------------------------------------------------
35 def runTest(frame
, nb
, log
):
36 win
= TestPanel(nb
, log
)
39 #---------------------------------------------------------------------------
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.
50 <p><code><b>MultipleChoiceDialog</b>(self, parent, msg, title, lst,
51 pos = wx.wxDefaultPosition, size = (200,200), style = wx.DEFAULT_DIALOG_STYLE)
55 <dt><code>parent</code>
59 <dd>The message that will be displayed above the list
61 <dt><code>title</code>
62 <dd>The text that will appear on the title bar
65 <dd>A Python list of choices that will appear in the dialog.
68 <dd>The position of the dialog
71 <dd>The size of the dialog
73 <dt><code>style</code>
74 <dd>The style for the dialog. Only styles normally available to wxDialog are
79 <b><font size=+1><code>Methods</code></font></b>
82 <dt><code>GetValue</code>
83 <dd>Returns a tuple containing the indices of the selected items
85 <dt><code>GetValueString</code>
86 <dd>Returns a tuple containing the text of the selected items
90 Additionally, MultipleChoiceDialog.lbox is a standard wx.ListBox which supports all
91 methods applicable to that class.
97 if __name__
== '__main__':
100 run
.main(['', os
.path
.basename(sys
.argv
[0])] + sys
.argv
[1:])