]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/AUI_MDI.py
5 #----------------------------------------------------------------------
8 class ParentFrame(wx
.aui
.AuiMDIParentFrame
):
9 def __init__(self
, parent
):
10 wx
.aui
.AuiMDIParentFrame
.__init
__(self
, parent
, -1,
11 title
="AuiMDIParentFrame",
14 mb
= self
.MakeMenuBar()
16 self
.CreateStatusBar()
18 def MakeMenuBar(self
):
21 item
= menu
.Append(-1, "New child window\tCtrl-N")
22 self
.Bind(wx
.EVT_MENU
, self
.OnNewChild
, item
)
23 item
= menu
.Append(-1, "Close parent")
24 self
.Bind(wx
.EVT_MENU
, self
.OnDoClose
, item
)
25 mb
.Append(menu
, "&File")
28 def OnNewChild(self
, evt
):
30 child
= ChildFrame(self
, self
.count
)
33 def OnDoClose(self
, evt
):
37 #----------------------------------------------------------------------
39 class ChildFrame(wx
.aui
.AuiMDIChildFrame
):
40 def __init__(self
, parent
, count
):
41 wx
.aui
.AuiMDIChildFrame
.__init
__(self
, parent
, -1,
42 title
="Child: %d" % count
)
43 mb
= parent
.MakeMenuBar()
45 item
= menu
.Append(-1, "This is child %d's menu" % count
)
46 mb
.Append(menu
, "&Child")
50 wx
.StaticText(p
, -1, "This is child %d" % count
, (10,10))
51 p
.SetBackgroundColour('light blue')
54 sizer
.Add(p
, 1, wx
.EXPAND
)
57 wx
.CallAfter(self
.Layout
)
59 #----------------------------------------------------------------------
61 class TestPanel(wx
.Panel
):
62 def __init__(self
, parent
, log
):
64 wx
.Panel
.__init
__(self
, parent
, -1)
66 b
= wx
.Button(self
, -1, "Show a AuiMDIParentFrame", (50,50))
67 self
.Bind(wx
.EVT_BUTTON
, self
.OnButton
, b
)
70 def OnButton(self
, evt
):
71 pf
= ParentFrame(self
)
76 #----------------------------------------------------------------------
78 def runTest(frame
, nb
, log
):
79 win
= TestPanel(nb
, log
)
82 #----------------------------------------------------------------------
86 overview
= """<html><body>
87 <h2><center>wx.aui.AuiMDI</center></h2>
89 The wx.aui.AuiMDIParentFrame and wx.aui.AuiMDIChildFrame classes
90 implement the same API as wx.MDIParentFrame and wx.MDIChildFrame, but
91 implement the multiple document interface with a wx.aui.AuiNotebook.
99 if __name__
== '__main__':
102 run
.main(['', os
.path
.basename(sys
.argv
[0])] + sys
.argv
[1:])