]>
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",
13 style
=wx
.DEFAULT_FRAME_STYLE
)
15 mb
= self
.MakeMenuBar()
17 self
.CreateStatusBar()
19 def MakeMenuBar(self
):
22 item
= menu
.Append(-1, "New child window\tCtrl-N")
23 self
.Bind(wx
.EVT_MENU
, self
.OnNewChild
, item
)
24 item
= menu
.Append(-1, "Close parent")
25 self
.Bind(wx
.EVT_MENU
, self
.OnDoClose
, item
)
26 mb
.Append(menu
, "&File")
29 def OnNewChild(self
, evt
):
31 child
= ChildFrame(self
, self
.count
)
34 def OnDoClose(self
, evt
):
38 #----------------------------------------------------------------------
40 class ChildFrame(wx
.aui
.AuiMDIChildFrame
):
41 def __init__(self
, parent
, count
):
42 wx
.aui
.AuiMDIChildFrame
.__init
__(self
, parent
, -1,
43 title
="Child: %d" % count
)
44 mb
= parent
.MakeMenuBar()
46 item
= menu
.Append(-1, "This is child %d's menu" % count
)
47 mb
.Append(menu
, "&Child")
51 wx
.StaticText(p
, -1, "This is child %d" % count
, (10,10))
52 p
.SetBackgroundColour('light blue')
55 sizer
.Add(p
, 1, wx
.EXPAND
)
58 wx
.CallAfter(self
.Layout
)
60 #----------------------------------------------------------------------
62 class TestPanel(wx
.Panel
):
63 def __init__(self
, parent
, log
):
65 wx
.Panel
.__init
__(self
, parent
, -1)
67 b
= wx
.Button(self
, -1, "Show a AuiMDIParentFrame", (50,50))
68 self
.Bind(wx
.EVT_BUTTON
, self
.OnButton
, b
)
71 def OnButton(self
, evt
):
72 pf
= ParentFrame(self
)
77 #----------------------------------------------------------------------
79 def runTest(frame
, nb
, log
):
80 win
= TestPanel(nb
, log
)
83 #----------------------------------------------------------------------
87 overview
= """<html><body>
88 <h2><center>wx.aui.AuiMDI</center></h2>
90 The wx.aui.AuiMDIParentFrame and wx.aui.AuiMDIChildFrame classes
91 implement the same API as wx.MDIParentFrame and wx.MDIChildFrame, but
92 implement the multiple document interface with a wx.aui.AuiNotebook.
100 if __name__
== '__main__':
103 run
.main(['', os
.path
.basename(sys
.argv
[0])] + sys
.argv
[1:])