]> git.saurik.com Git - wxWidgets.git/blame_incremental - wxPython/demo/wxGenericDirCtrl.py
Show how to get the right position for HitTest from a mouse event position
[wxWidgets.git] / wxPython / demo / wxGenericDirCtrl.py
... / ...
CommitLineData
1from wxPython.wx import *
2
3#----------------------------------------------------------------------
4
5class TestPanel(wxPanel):
6 def __init__(self, parent, log):
7 wxPanel.__init__(self, parent, -1)
8 self.log = log
9
10 txt1 = wxStaticText(self, -1, "style=0")
11 dir1 = wxGenericDirCtrl(self, -1, size=(200,225), style=0)
12
13 txt2 = wxStaticText(self, -1, "wxDIRCTRL_DIR_ONLY")
14 dir2 = wxGenericDirCtrl(self, -1, size=(200,225), style=wxDIRCTRL_DIR_ONLY)
15
16 txt3 = wxStaticText(self, -1, "wxDIRCTRL_SHOW_FILTERS")
17 dir3 = wxGenericDirCtrl(self, -1, size=(200,225), style=wxDIRCTRL_SHOW_FILTERS,
18 filter="All files (*.*)|*.*|Python files (*.py)|*.py")
19
20 sz = wxFlexGridSizer(cols=3, hgap=5, vgap=5)
21 sz.Add(35, 35) # some space above
22 sz.Add(35, 35)
23 sz.Add(35, 35)
24
25 sz.Add(txt1)
26 sz.Add(txt2)
27 sz.Add(txt3)
28
29 sz.Add(dir1, 0, wxEXPAND)
30 sz.Add(dir2, 0, wxEXPAND)
31 sz.Add(dir3, 0, wxEXPAND)
32
33 sz.Add(35,35) # some space below
34
35 sz.AddGrowableRow(2)
36 sz.AddGrowableCol(0)
37 sz.AddGrowableCol(1)
38 sz.AddGrowableCol(2)
39 self.SetSizer(sz)
40 self.SetAutoLayout(True)
41
42
43#----------------------------------------------------------------------
44
45def runTest(frame, nb, log):
46 win = TestPanel(nb, log)
47 return win
48
49
50#----------------------------------------------------------------------
51
52
53
54
55
56overview = """\
57This control can be used to place a directory listing (with optional files)
58on an arbitrary window.
59"""
60
61
62if __name__ == '__main__':
63 import sys,os
64 import run
65 run.main(['', os.path.basename(sys.argv[0])])
66