]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/DirDialog.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 DirDialog", (50,50)) 
  12         self
.Bind(wx
.EVT_BUTTON
, self
.OnButton
, b
) 
  15     def OnButton(self
, evt
): 
  16         # In this case we include a "New directory" button.  
  17         dlg 
= wx
.DirDialog(self
, "Choose a directory:", 
  18                           style
=wx
.DD_DEFAULT_STYLE
 
  19                            #| wx.DD_DIR_MUST_EXIST 
  23         # If the user selects OK, then we process the dialog's data. 
  24         # This is done by getting the path data from the dialog - BEFORE 
  26         if dlg
.ShowModal() == wx
.ID_OK
: 
  27             self
.log
.WriteText('You selected: %s\n' % dlg
.GetPath()) 
  29         # Only destroy a dialog after you're done with it. 
  33 #--------------------------------------------------------------------------- 
  36 def runTest(frame
, nb
, log
): 
  37     win 
= TestPanel(nb
, log
) 
  41 #--------------------------------------------------------------------------- 
  47 This class represents the directory chooser dialog.  It is used when all you 
  48 need from the user is the name of a directory. Data is retrieved via utility 
  49 methods; see the <code>DirDialog</code> documentation for specifics. 
  53 if __name__ 
== '__main__': 
  56     run
.main(['', os
.path
.basename(sys
.argv
[0])] + sys
.argv
[1:])