]> git.saurik.com Git - wxWidgets.git/blob - wxPython/samples/wxPIA_book/Chapter-08/mdi.py
Added the sample code from wxPython In Action to the samples dir
[wxWidgets.git] / wxPython / samples / wxPIA_book / Chapter-08 / mdi.py
1 import wx
2
3 class MDIFrame(wx.MDIParentFrame):
4 def __init__(self):
5 wx.MDIParentFrame.__init__(self, None, -1, "MDI Parent",
6 size=(600,400))
7 menu = wx.Menu()
8 menu.Append(5000, "&New Window")
9 menu.Append(5001, "E&xit")
10 menubar = wx.MenuBar()
11 menubar.Append(menu, "&File")
12 self.SetMenuBar(menubar)
13 self.Bind(wx.EVT_MENU, self.OnNewWindow, id=5000)
14 self.Bind(wx.EVT_MENU, self.OnExit, id=5001)
15
16 def OnExit(self, evt):
17 self.Close(True)
18
19 def OnNewWindow(self, evt):
20 win = wx.MDIChildFrame(self, -1, "Child Window")
21 win.Show(True)
22
23 if __name__ == '__main__':
24 app = wx.PySimpleApp()
25 frame = MDIFrame()
26 frame.Show()
27 app.MainLoop()
28
29