]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/SingleChoiceDialog.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 SingleChoiceDialog", (50,50)) 
  12         self
.Bind(wx
.EVT_BUTTON
, self
.OnButton
, b
) 
  15     def OnButton(self
, evt
): 
  16         dlg 
= wx
.SingleChoiceDialog( 
  17                 self
, 'Test Single Choice', 'The Caption', 
  18                 ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight'],  
  22         if dlg
.ShowModal() == wx
.ID_OK
: 
  23             self
.log
.WriteText('You selected: %s\n' % dlg
.GetStringSelection()) 
  29 #--------------------------------------------------------------------------- 
  32 def runTest(frame
, nb
, log
): 
  33     win 
= TestPanel(nb
, log
) 
  35 #--------------------------------------------------------------------------- 
  41 This class represents a dialog that shows a list of strings, and allows the user 
  42 to select one. Double-clicking on a list item is equivalent to single-clicking 
  45 As with all dialogs, be sure to retrieve the information you need BEFORE you 
  51 if __name__ 
== '__main__': 
  54     run
.main(['', os
.path
.basename(sys
.argv
[0])] + sys
.argv
[1:])