]>
Commit | Line | Data |
---|---|---|
06c0fba4 RD |
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 | ||
de20db99 | 22 | self.CreateStatusBar() |
06c0fba4 RD |
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) | |
f6bcfd97 | 35 | canvas = MyCanvas(win) |
06c0fba4 RD |
36 | win.Show(true) |
37 | ||
38 | ||
39 | #---------------------------------------------------------------------- | |
40 | ||
9c67cbec RD |
41 | if __name__ == '__main__': |
42 | class MyApp(wxApp): | |
43 | def OnInit(self): | |
4d5a7477 | 44 | wxInitAllImageHandlers() |
9c67cbec RD |
45 | frame = MyParentFrame() |
46 | frame.Show(true) | |
47 | self.SetTopWindow(frame) | |
48 | return true | |
06c0fba4 RD |
49 | |
50 | ||
9c67cbec RD |
51 | app = MyApp(0) |
52 | app.MainLoop() | |
06c0fba4 RD |
53 | |
54 | ||
55 |