]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/MDIDemo.py
4 # Importing ScrolledWindow demo to make use of the MyCanvas
5 # class defined within.
11 #----------------------------------------------------------------------
14 #----------------------------------------------------------------------
16 class MyParentFrame(wx
.MDIParentFrame
):
18 wx
.MDIParentFrame
.__init
__(self
, None, -1, "MDI Parent", size
=(600,400))
22 menu
.Append(ID_New
, "&New Window")
23 menu
.AppendSeparator()
24 menu
.Append(ID_Exit
, "E&xit")
26 menubar
= wx
.MenuBar()
27 menubar
.Append(menu
, "&File")
28 self
.SetMenuBar(menubar
)
30 self
.CreateStatusBar()
32 self
.Bind(wx
.EVT_MENU
, self
.OnNewWindow
, id=ID_New
)
33 self
.Bind(wx
.EVT_MENU
, self
.OnExit
, id=ID_Exit
)
36 self
.bg_bmp
= images
.getGridBGBitmap()
37 self
.GetClientWindow().Bind(
38 wx
.EVT_ERASE_BACKGROUND
, self
.OnEraseBackground
42 def OnExit(self
, evt
):
46 def OnNewWindow(self
, evt
):
47 self
.winCount
= self
.winCount
+ 1
48 win
= wx
.MDIChildFrame(self
, -1, "Child Window: %d" % self
.winCount
)
49 canvas
= ScrolledWindow
.MyCanvas(win
)
53 def OnEraseBackground(self
, evt
):
57 dc
= wx
.ClientDC(self
.GetClientWindow())
59 # tile the background bitmap
60 sz
= self
.GetClientSize()
61 w
= self
.bg_bmp
.GetWidth()
62 h
= self
.bg_bmp
.GetHeight()
69 dc
.DrawBitmap(self
.bg_bmp
, (x
, y
))
75 #----------------------------------------------------------------------
77 if __name__
== '__main__':
80 wx
.InitAllImageHandlers()
81 frame
= MyParentFrame()
83 self
.SetTopWindow(frame
)