]> git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/MultiChoiceDialog.py
fix building/running of tex2rtf
[wxWidgets.git] / wxPython / demo / MultiChoiceDialog.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 wx.MultiChoiceDialog", (50,50))
12 self.Bind(wx.EVT_BUTTON, self.OnButton, b)
13
14
15 def OnButton(self, evt):
16 lst = [ 'apple', 'pear', 'banana', 'coconut', 'orange', 'grape', 'pineapple',
17 'blueberry', 'raspberry', 'blackberry', 'snozzleberry',
18 'etc', 'etc..', 'etc...' ]
19
20 dlg = wx.MultiChoiceDialog( self,
21 "Pick some fruit from\nthis list",
22 "wx.MultiChoiceDialog", lst)
23
24 if (dlg.ShowModal() == wx.ID_OK):
25 selections = dlg.GetSelections()
26 strings = [lst[x] for x in selections]
27 self.log.write("Selections: %s -> %s\n" % (selections, strings))
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 <h1>wx.MultiChoiceDialog</h1>
47
48 This class represents a dialog that shows a list of strings, and
49 allows the user to select one or more.
50
51 </body>
52 </html>
53 """
54
55 if __name__ == '__main__':
56 import sys,os
57 import run
58 run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])