2001-04-02 01:57:32 -04:00
|
|
|
#----------------------------------------------------------------------------
|
|
|
|
# Name: ImageBrowser.py
|
|
|
|
# Purpose: Image Selection dialog for wxPython demo
|
|
|
|
#
|
|
|
|
# Author: Lorne White (email: lorne.white@telusplanet.net)
|
|
|
|
#
|
2003-07-02 19:13:10 -04:00
|
|
|
# Version 0.5
|
2001-04-02 01:57:32 -04:00
|
|
|
# Date: Feb 26, 2001
|
|
|
|
# Licence: wxWindows license
|
|
|
|
#----------------------------------------------------------------------------
|
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
import os
|
2001-04-02 01:57:32 -04:00
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
import wx
|
|
|
|
import wx.lib.imagebrowser as ib
|
2001-04-02 01:57:32 -04:00
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
def runTest(frame, nb, log):
|
2003-12-08 20:23:28 -05:00
|
|
|
# get current working directory
|
|
|
|
dir = os.getcwd()
|
|
|
|
|
|
|
|
# set the initial directory for the demo bitmaps
|
|
|
|
initial_dir = os.path.join(dir, 'bitmaps')
|
|
|
|
|
|
|
|
# open the image browser dialog
|
|
|
|
win = ib.ImageDialog(frame, initial_dir)
|
|
|
|
|
2001-04-02 01:57:32 -04:00
|
|
|
win.Centre()
|
2003-12-08 20:23:28 -05:00
|
|
|
|
|
|
|
if win.ShowModal() == wx.ID_OK:
|
|
|
|
# show the selected file
|
|
|
|
log.WriteText("You Selected File: " + win.GetFile())
|
2001-04-02 01:57:32 -04:00
|
|
|
else:
|
|
|
|
log.WriteText("You pressed Cancel\n")
|
2003-07-02 19:13:10 -04:00
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
win.Destroy()
|
|
|
|
|
2001-04-02 01:57:32 -04:00
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
overview = """\
|
|
|
|
"""
|
2003-07-02 19:13:10 -04:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
import sys,os
|
|
|
|
import run
|
|
|
|
run.main(['', os.path.basename(sys.argv[0])])
|
|
|
|
|