]>
Commit | Line | Data |
---|---|---|
cf694132 | 1 | |
8fa876ca | 2 | import wx |
cf694132 RD |
3 | |
4 | #--------------------------------------------------------------------------- | |
5 | ||
34a544a6 RD |
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 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:", | |
cbfc9df6 RD |
18 | style=wx.DD_DEFAULT_STYLE |
19 | #| wx.DD_DIR_MUST_EXIST | |
20 | #| wx.DD_CHANGE_DIR | |
21 | ) | |
34a544a6 RD |
22 | |
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 | |
25 | # we destroy it. | |
26 | if dlg.ShowModal() == wx.ID_OK: | |
27 | self.log.WriteText('You selected: %s\n' % dlg.GetPath()) | |
28 | ||
29 | # Only destroy a dialog after you're done with it. | |
30 | dlg.Destroy() | |
8fa876ca | 31 | |
8fa876ca | 32 | |
34a544a6 RD |
33 | #--------------------------------------------------------------------------- |
34 | ||
35 | ||
36 | def runTest(frame, nb, log): | |
37 | win = TestPanel(nb, log) | |
38 | return win | |
39 | ||
cf694132 RD |
40 | |
41 | #--------------------------------------------------------------------------- | |
42 | ||
43 | ||
44 | ||
34a544a6 | 45 | |
cf694132 | 46 | overview = """\ |
8fa876ca RD |
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. | |
fe953afb | 50 | """ |
cf694132 | 51 | |
cf694132 | 52 | |
fe953afb RD |
53 | if __name__ == '__main__': |
54 | import sys,os | |
55 | import run | |
8eca4fef | 56 | run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:]) |
cf694132 | 57 |