]> git.saurik.com Git - wxWidgets.git/blame - wxPython/demo/ImageBrowser.py
Show EVT_ACTIVATE and EVT_ACTIVATE_APP events in action.
[wxWidgets.git] / wxPython / demo / ImageBrowser.py
CommitLineData
49875c53
RD
1#----------------------------------------------------------------------------
2# Name: ImageBrowser.py
3# Purpose: Image Selection dialog for wxPython demo
4#
5# Author: Lorne White (email: lorne.white@telusplanet.net)
6#
1fded56b 7# Version 0.5
49875c53
RD
8# Date: Feb 26, 2001
9# Licence: wxWindows license
10#----------------------------------------------------------------------------
11
8fa876ca 12import os
49875c53 13
8fa876ca
RD
14import wx
15import wx.lib.imagebrowser as ib
34a544a6
RD
16
17
49875c53
RD
18#---------------------------------------------------------------------------
19
34a544a6
RD
20class TestPanel(wx.Panel):
21 def __init__(self, parent, log):
22 self.log = log
23 wx.Panel.__init__(self, parent, -1)
8fa876ca 24
34a544a6
RD
25 b = wx.Button(self, -1, "Create and Show an ImageDialog", (50,50))
26 self.Bind(wx.EVT_BUTTON, self.OnButton, b)
8fa876ca 27
8fa876ca 28
34a544a6
RD
29 def OnButton(self, evt):
30 # get current working directory
31 dir = os.getcwd()
32
33 # set the initial directory for the demo bitmaps
34 initial_dir = os.path.join(dir, 'bitmaps')
35
36 # open the image browser dialog
37 dlg = ib.ImageDialog(self, initial_dir)
38
39 dlg.Centre()
40
41 if dlg.ShowModal() == wx.ID_OK:
42 # show the selected file
43 self.log.WriteText("You Selected File: " + dlg.GetFile())
44 else:
45 self.log.WriteText("You pressed Cancel\n")
46
47 dlg.Destroy()
48
49
50#---------------------------------------------------------------------------
51
52
53def runTest(frame, nb, log):
54 win = TestPanel(nb, log)
55 return win
1fded56b 56
8fa876ca 57
49875c53
RD
58#---------------------------------------------------------------------------
59
60
49875c53
RD
61overview = """\
62"""
1fded56b 63
1fded56b
RD
64if __name__ == '__main__':
65 import sys,os
66 import run
8eca4fef 67 run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])
1fded56b 68