]> git.saurik.com Git - wxWidgets.git/blame - wxPython/demo/AUI_MDI.py
corrected ctor signature
[wxWidgets.git] / wxPython / demo / AUI_MDI.py
CommitLineData
34d71f81
RD
1
2import wx
3import wx.aui
4
5#----------------------------------------------------------------------
6
7
8class ParentFrame(wx.aui.AuiMDIParentFrame):
9 def __init__(self, parent):
10 wx.aui.AuiMDIParentFrame.__init__(self, parent, -1,
11 title="AuiMDIParentFrame",
12 size=(640,480))
13 self.count = 0
14 mb = self.MakeMenuBar()
15 self.SetMenuBar(mb)
16 self.CreateStatusBar()
17
18 def MakeMenuBar(self):
19 mb = wx.MenuBar()
20 menu = wx.Menu()
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")
26 return mb
27
28 def OnNewChild(self, evt):
29 self.count += 1
30 child = ChildFrame(self, self.count)
31 child.Show()
32
33 def OnDoClose(self, evt):
34 self.Close()
35
36
37#----------------------------------------------------------------------
38
39class 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()
44 menu = wx.Menu()
45 item = menu.Append(-1, "This is child %d's menu" % count)
46 mb.Append(menu, "&Child")
47 self.SetMenuBar(mb)
48
49 p = wx.Panel(self)
50 wx.StaticText(p, -1, "This is child %d" % count, (10,10))
51 p.SetBackgroundColour('light blue')
52
53 sizer = wx.BoxSizer()
54 sizer.Add(p, 1, wx.EXPAND)
55 self.SetSizer(sizer)
56
57 wx.CallAfter(self.Layout)
58
59#----------------------------------------------------------------------
60
61class TestPanel(wx.Panel):
62 def __init__(self, parent, log):
63 self.log = log
64 wx.Panel.__init__(self, parent, -1)
65
66 b = wx.Button(self, -1, "Show a AuiMDIParentFrame", (50,50))
67 self.Bind(wx.EVT_BUTTON, self.OnButton, b)
68
69
70 def OnButton(self, evt):
71 pf = ParentFrame(self)
72 pf.Show()
73
74
75
76#----------------------------------------------------------------------
77
78def runTest(frame, nb, log):
79 win = TestPanel(nb, log)
80 return win
81
82#----------------------------------------------------------------------
83
84
85
86overview = """<html><body>
87<h2><center>wx.aui.AuiMDI</center></h2>
88
89The wx.aui.AuiMDIParentFrame and wx.aui.AuiMDIChildFrame classes
90implement the same API as wx.MDIParentFrame and wx.MDIChildFrame, but
91implement the multiple document interface with a wx.aui.AuiNotebook.
92
93
94</body></html>
95"""
96
97
98
99if __name__ == '__main__':
100 import sys,os
101 import run
102 run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])
103