]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/ImageBrowser.py
   1 #---------------------------------------------------------------------------- 
   2 # Name:         ImageBrowser.py 
   3 # Purpose:      Image Selection dialog for wxPython demo 
   5 # Author:       Lorne White (email: lorne.white@telusplanet.net) 
   9 # Licence:      wxWindows license 
  10 #---------------------------------------------------------------------------- 
  15 import  wx
.lib
.imagebrowser    
as  ib
 
  18 #--------------------------------------------------------------------------- 
  20 class TestPanel(wx
.Panel
): 
  21     def __init__(self
, parent
, log
): 
  23         wx
.Panel
.__init
__(self
, parent
, -1) 
  25         b 
= wx
.Button(self
, -1, "Create and Show an ImageDialog", (50,50)) 
  26         self
.Bind(wx
.EVT_BUTTON
, self
.OnButton
, b
) 
  29     def OnButton(self
, evt
): 
  30         # get current working directory 
  33         # set the initial directory for the demo bitmaps 
  34         initial_dir 
= os
.path
.join(dir, 'bitmaps') 
  36         # open the image browser dialog 
  37         dlg 
= ib
.ImageDialog(self
, initial_dir
) 
  41         if dlg
.ShowModal() == wx
.ID_OK
: 
  42             # show the selected file 
  43             self
.log
.WriteText("You Selected File: " + dlg
.GetFile())         
  45             self
.log
.WriteText("You pressed Cancel\n") 
  50 #--------------------------------------------------------------------------- 
  53 def runTest(frame
, nb
, log
): 
  54     win 
= TestPanel(nb
, log
) 
  58 #--------------------------------------------------------------------------- 
  64 if __name__ 
== '__main__': 
  67     run
.main(['', os
.path
.basename(sys
.argv
[0])] + sys
.argv
[1:])