]> git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/MDIDemo.py
patch fix for a constant definition under OS/2 VA V4.0
[wxWidgets.git] / 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 canvas = MyCanvas(win)
36 win.Show(true)
37
38
39 #----------------------------------------------------------------------
40
41 class MyApp(wxApp):
42 def OnInit(self):
43 frame = MyParentFrame()
44 frame.Show(true)
45 self.SetTopWindow(frame)
46 return true
47
48
49 app = MyApp(0)
50 app.MainLoop()
51
52
53