]> git.saurik.com Git - wxWidgets.git/blame - wxPython/demo/FileBrowseButton.py
fix text scrolling in GTK2 (patch 703988)
[wxWidgets.git] / wxPython / demo / FileBrowseButton.py
CommitLineData
1b62f00d 1""" Demonstrate filebrowsebutton module of the wxPython.lib Library.
f6bcfd97 2
1b62f00d
RD
314.1.2001 Bernhard Reiter <bernhard@intevation.de>
4 Added demo for DirBrowseButton and improved overview text.
5"""
f6bcfd97 6from wxPython.wx import *
1b62f00d 7from wxPython.lib.filebrowsebutton import FileBrowseButton, FileBrowseButtonWithHistory,DirBrowseButton
f6bcfd97
BP
8
9
10#----------------------------------------------------------------------
11
12class TestPanel(wxPanel):
13 def __init__(self, parent, ID, log):
14 wxPanel.__init__(self, parent, ID)
15 self.log = log
16 self.fbb = FileBrowseButton(self, -1, wxPoint(20,20), wxSize(450, -1),
17 changeCallback = self.fbbCallback)
18 self.fbbh = FileBrowseButtonWithHistory(self, -1, wxPoint(20, 50),
19 wxSize(450, -1),
20 #changeCallback = self.fbbhCallback
21 )
1b62f00d
RD
22 self.dbb = DirBrowseButton(self, -1, wxPoint(20,80), wxSize(450,-1),
23 changeCallback = self.dbbCallback)
24
f6bcfd97
BP
25
26 self.fbbh.SetHistory(['You', 'can', 'put', 'some', 'file', 'names', 'here'])
27
28
29 def fbbCallback(self, evt):
30 self.log.write('FileBrowseButton: %s\n' % evt.GetString())
31
32
1b62f00d 33
f6bcfd97
BP
34 def fbbhCallback(self, evt):
35 if hasattr(self, 'fbbh'):
36 value = evt.GetString()
37 self.log.write('FileBrowseButtonWithHistory: %s\n' % value)
38 history = self.fbbh.GetHistory()
39 history.append(value)
40 self.fbbh.SetHistory(history)
41
1b62f00d
RD
42 def dbbCallback(self, evt):
43 self.log.write('DirBrowseButton: %s\n' % evt.GetString())
44
45
f6bcfd97
BP
46
47#----------------------------------------------------------------------
48
49def runTest(frame, nb, log):
50 win = TestPanel(nb, -1, log)
51 return win
52
53
54
55#----------------------------------------------------------------------
56
1b62f00d
RD
57overview = """<html><body>
58<h2>class FileBrowseButton:</h2>
59<small><pre>
60%s
61</pre></small>
62
63<h2>class FileBrowseButtonWithHistory(FileBrowseButton):</h2>
64<small><pre>
65%s
66</pre></small>
67
68<h2>class DirBrowseButton(FileBrowseButton):</h2>
69<small><pre>
70%s
71</pre></small>
72
73</body><</html>
74""" % ( FileBrowseButton.__doc__,
75 FileBrowseButtonWithHistory.__doc__ ,
76 str(DirBrowseButton.__doc__) )
1fded56b
RD
77
78
79
80
81if __name__ == '__main__':
82 import sys,os
83 import run
84 run.main(['', os.path.basename(sys.argv[0])])
85