| 1 | #---------------------------------------------------------------------------- |
| 2 | # Name: ImageBrowser.py |
| 3 | # Purpose: Image Selection dialog for wxPython demo |
| 4 | # |
| 5 | # Author: Lorne White (email: lorne.white@telusplanet.net) |
| 6 | # |
| 7 | # Version 0.5 |
| 8 | # Date: Feb 26, 2001 |
| 9 | # Licence: wxWindows license |
| 10 | #---------------------------------------------------------------------------- |
| 11 | |
| 12 | import os |
| 13 | |
| 14 | import wx |
| 15 | import wx.lib.imagebrowser as ib |
| 16 | #--------------------------------------------------------------------------- |
| 17 | |
| 18 | def runTest(frame, nb, log): |
| 19 | # get current working directory |
| 20 | dir = os.getcwd() |
| 21 | |
| 22 | # set the initial directory for the demo bitmaps |
| 23 | initial_dir = os.path.join(dir, 'bitmaps') |
| 24 | |
| 25 | # open the image browser dialog |
| 26 | win = ib.ImageDialog(frame, initial_dir) |
| 27 | |
| 28 | win.Centre() |
| 29 | |
| 30 | if win.ShowModal() == wx.ID_OK: |
| 31 | # show the selected file |
| 32 | log.WriteText("You Selected File: " + win.GetFile()) |
| 33 | else: |
| 34 | log.WriteText("You pressed Cancel\n") |
| 35 | |
| 36 | win.Destroy() |
| 37 | |
| 38 | #--------------------------------------------------------------------------- |
| 39 | |
| 40 | |
| 41 | overview = """\ |
| 42 | """ |
| 43 | |
| 44 | if __name__ == '__main__': |
| 45 | import sys,os |
| 46 | import run |
| 47 | run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:]) |
| 48 | |