]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/MDIDemo.py
3 # 11/12/2003 - Jeff Grimmett (grimmtooth@softhome.net)
5 # o Updated for wx namespace
6 # o Replaced hardcoded menu IDs with dynamic IDs
11 # Importing wxScrolledWindow demo to make use of the MyCanvas
12 # class defined within.
13 import wxScrolledWindow
18 #----------------------------------------------------------------------
21 #----------------------------------------------------------------------
23 class MyParentFrame(wx
.MDIParentFrame
):
25 wx
.MDIParentFrame
.__init
__(self
, None, -1, "MDI Parent", size
=(600,400))
29 menu
.Append(ID_New
, "&New Window")
30 menu
.AppendSeparator()
31 menu
.Append(ID_Exit
, "E&xit")
33 menubar
= wx
.MenuBar()
34 menubar
.Append(menu
, "&File")
35 self
.SetMenuBar(menubar
)
37 self
.CreateStatusBar()
39 self
.Bind(wx
.EVT_MENU
, self
.OnNewWindow
, id=ID_New
)
40 self
.Bind(wx
.EVT_MENU
, self
.OnExit
, id=ID_Exit
)
43 self
.bg_bmp
= images
.getGridBGBitmap()
44 self
.GetClientWindow().Bind(
45 wx
.EVT_ERASE_BACKGROUND
, self
.OnEraseBackground
49 def OnExit(self
, evt
):
53 def OnNewWindow(self
, evt
):
54 self
.winCount
= self
.winCount
+ 1
55 win
= wx
.MDIChildFrame(self
, -1, "Child Window: %d" % self
.winCount
)
56 canvas
= wxScrolledWindow
.MyCanvas(win
)
60 def OnEraseBackground(self
, evt
):
64 dc
= wx
.ClientDC(self
.GetClientWindow())
66 # tile the background bitmap
67 sz
= self
.GetClientSize()
68 w
= self
.bg_bmp
.GetWidth()
69 h
= self
.bg_bmp
.GetHeight()
76 dc
.DrawBitmap(self
.bg_bmp
, (x
, y
))
82 #----------------------------------------------------------------------
84 if __name__
== '__main__':
87 wx
.InitAllImageHandlers()
88 frame
= MyParentFrame()
90 self
.SetTopWindow(frame
)