1 # 11/7/2003 - Jeff Grimmett (grimmtooth@softhome.net)
3 # o Updated for wx namespace
4 # o Uncommented fbbhCallback in TestPanel.fbbh init. Appears to work fine.
5 # Wonder why it was commented.
6 # o Unrelated: TestPanel.dbb appears to cause a program error in the demo. If
7 # it is commented out, everything works fine. Investigating.
8 # o Bernhard has responded to query, does not plan on updating demo.
10 # 11/25/2003 - Jeff Grimmett (grimmtooth@softhome.net)
12 # o All issues, including the program error, have gone away in V2.5.
15 """ Demonstrate filebrowsebutton module of the wxPython.lib Library.
17 14.1.2001 Bernhard Reiter <bernhard@intevation.de>
18 Added demo for DirBrowseButton and improved overview text.
22 import wx
.lib
.filebrowsebutton
as filebrowse
24 #----------------------------------------------------------------------
26 class TestPanel(wx
.Panel
):
27 def __init__(self
, parent
, ID
, log
):
28 wx
.Panel
.__init
__(self
, parent
, ID
)
31 self
.fbb
= filebrowse
.FileBrowseButton(
32 self
, -1, (20, 20), (450, -1), changeCallback
= self
.fbbCallback
35 self
.fbbh
= filebrowse
.FileBrowseButtonWithHistory(
36 self
, -1, (20, 50), (450, -1), changeCallback
= self
.fbbhCallback
39 self
.dbb
= filebrowse
.DirBrowseButton(
40 self
, -1, (20, 80), (450, -1), changeCallback
= self
.dbbCallback
43 self
.fbbh
.SetHistory(['You', 'can', 'put', 'some', 'file', 'names', 'here'])
46 def fbbCallback(self
, evt
):
47 self
.log
.write('FileBrowseButton: %s\n' % evt
.GetString())
50 def fbbhCallback(self
, evt
):
51 if hasattr(self
, 'fbbh'):
52 value
= evt
.GetString()
53 self
.log
.write('FileBrowseButtonWithHistory: %s\n' % value
)
54 history
= self
.fbbh
.GetHistory()
56 self
.fbbh
.SetHistory(history
)
59 def dbbCallback(self
, evt
):
60 self
.log
.write('DirBrowseButton: %s\n' % evt
.GetString())
63 #----------------------------------------------------------------------
65 def runTest(frame
, nb
, log
):
66 win
= TestPanel(nb
, -1, log
)
70 #----------------------------------------------------------------------
72 overview
= """<html><body>
73 <h2>class FileBrowseButton:</h2>
78 <h2>class FileBrowseButtonWithHistory(FileBrowseButton):</h2>
83 <h2>class DirBrowseButton(FileBrowseButton):</h2>
89 """ % ( filebrowse
.FileBrowseButton
.__doc
__,
90 filebrowse
.FileBrowseButtonWithHistory
.__doc
__ ,
91 filebrowse
.DirBrowseButton
.__doc
__
95 if __name__
== '__main__':
98 run
.main(['', os
.path
.basename(sys
.argv
[0])])