]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/MultiChoiceDialog.py
   4 #--------------------------------------------------------------------------- 
   6 class TestPanel(wx
.Panel
): 
   7     def __init__(self
, parent
, log
): 
   9         wx
.Panel
.__init
__(self
, parent
, -1) 
  11         b 
= wx
.Button(self
, -1, "Create and Show a wx.MultiChoiceDialog", (50,50)) 
  12         self
.Bind(wx
.EVT_BUTTON
, self
.OnButton
, b
) 
  15     def OnButton(self
, evt
): 
  16         lst 
= [ 'apple', 'pear', 'banana', 'coconut', 'orange', 'grape', 'pineapple', 
  17                 'blueberry', 'raspberry', 'blackberry', 'snozzleberry', 
  18                 'etc', 'etc..', 'etc...' ] 
  20         dlg 
= wx
.MultiChoiceDialog( self
,  
  21                                    "Pick some fruit from\nthis list", 
  22                                    "wx.MultiChoiceDialog", lst
) 
  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
)) 
  33 #--------------------------------------------------------------------------- 
  35 def runTest(frame
, nb
, log
): 
  36     win 
= TestPanel(nb
, log
) 
  39 #--------------------------------------------------------------------------- 
  46 <h1>wx.MultiChoiceDialog</h1> 
  48 This class represents a dialog that shows a list of strings, and 
  49 allows the user to select one or more. 
  55 if __name__ 
== '__main__': 
  58     run
.main(['', os
.path
.basename(sys
.argv
[0])] + sys
.argv
[1:])