]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/MDIDemo.py
3 from wxPython
.wx
import *
4 from wxScrolledWindow
import MyCanvas
9 #----------------------------------------------------------------------
11 class MyParentFrame(wxMDIParentFrame
):
13 wxMDIParentFrame
.__init
__(self
, None, -1, "MDI Parent", size
=(600,400))
17 menu
.Append(5000, "&New Window")
18 menu
.AppendSeparator()
19 menu
.Append(5001, "E&xit")
22 menubar
.Append(menu
, "&File")
23 self
.SetMenuBar(menubar
)
25 self
.CreateStatusBar()
27 EVT_MENU(self
, 5000, self
.OnNewWindow
)
28 EVT_MENU(self
, 5001, self
.OnExit
)
31 self
.bg_bmp
= images
.getGridBGBitmap()
32 EVT_ERASE_BACKGROUND(self
.GetClientWindow(), self
.OnEraseBackground
)
35 def OnExit(self
, evt
):
39 def OnNewWindow(self
, evt
):
40 self
.winCount
= self
.winCount
+ 1
41 win
= wxMDIChildFrame(self
, -1, "Child Window: %d" % self
.winCount
)
42 canvas
= MyCanvas(win
)
46 def OnEraseBackground(self
, evt
):
49 dc
= wxClientDC(self
.GetClientWindow())
51 # tile the background bitmap
52 sz
= self
.GetClientSize()
53 w
= self
.bg_bmp
.GetWidth()
54 h
= self
.bg_bmp
.GetHeight()
59 dc
.DrawBitmap(self
.bg_bmp
, x
, y
)
64 #----------------------------------------------------------------------
66 if __name__
== '__main__':
69 wxInitAllImageHandlers()
70 frame
= MyParentFrame()
72 self
.SetTopWindow(frame
)