]> git.saurik.com Git - wxWidgets.git/blob - utils/wxPython/demo/MDIDemo.py
wxPython stuff:
[wxWidgets.git] / utils / wxPython / demo / MDIDemo.py
1 #!/usr/bin/env python
2
3 from wxPython.wx import *
4 from wxScrolledWindow import MyCanvas
5
6 #----------------------------------------------------------------------
7
8 class MyParentFrame(wxMDIParentFrame):
9 def __init__(self):
10 wxMDIParentFrame.__init__(self, None, -1, "MDI Parent", size=(600,400))
11
12 self.winCount = 0
13 menu = wxMenu()
14 menu.Append(5000, "&New Window")
15 menu.AppendSeparator()
16 menu.Append(5001, "E&xit")
17
18 menubar = wxMenuBar()
19 menubar.Append(menu, "&File")
20 self.SetMenuBar(menubar)
21
22 #self.CreateStatusBar()
23
24 EVT_MENU(self, 5000, self.OnNewWindow)
25 EVT_MENU(self, 5001, self.OnExit)
26
27
28 def OnExit(self, evt):
29 self.Close(true)
30
31
32 def OnNewWindow(self, evt):
33 self.winCount = self.winCount + 1
34 win = wxMDIChildFrame(self, -1, "Child Window: %d" % self.winCount)
35 cs = win.GetClientSize()
36 canvas = MyCanvas(win, size=cs)
37 win.Show(true)
38
39
40 #----------------------------------------------------------------------
41
42 class MyApp(wxApp):
43 def OnInit(self):
44 frame = MyParentFrame()
45 frame.Show(true)
46 self.SetTopWindow(frame)
47 return true
48
49
50 app = MyApp(0)
51 app.MainLoop()
52
53
54