]> git.saurik.com Git - wxWidgets.git/blame - wxPython/demo/DirDialog.py
Add BitmapFromBuffer demo
[wxWidgets.git] / wxPython / demo / DirDialog.py
CommitLineData
cf694132 1
8fa876ca 2import wx
cf694132
RD
3
4#---------------------------------------------------------------------------
5
34a544a6
RD
6class 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 DirDialog", (50,50))
12 self.Bind(wx.EVT_BUTTON, self.OnButton, b)
13
14
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|wx.DD_NEW_DIR_BUTTON)
19
20 # If the user selects OK, then we process the dialog's data.
21 # This is done by getting the path data from the dialog - BEFORE
22 # we destroy it.
23 if dlg.ShowModal() == wx.ID_OK:
24 self.log.WriteText('You selected: %s\n' % dlg.GetPath())
25
26 # Only destroy a dialog after you're done with it.
27 dlg.Destroy()
8fa876ca 28
8fa876ca 29
34a544a6
RD
30#---------------------------------------------------------------------------
31
32
33def runTest(frame, nb, log):
34 win = TestPanel(nb, log)
35 return win
36
cf694132
RD
37
38#---------------------------------------------------------------------------
39
40
41
34a544a6 42
cf694132 43overview = """\
8fa876ca
RD
44This class represents the directory chooser dialog. It is used when all you
45need from the user is the name of a directory. Data is retrieved via utility
46methods; see the <code>DirDialog</code> documentation for specifics.
fe953afb 47"""
cf694132 48
cf694132 49
fe953afb
RD
50if __name__ == '__main__':
51 import sys,os
52 import run
8eca4fef 53 run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])
cf694132 54