]> git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/MDIWindows.py
Moved wxHtmlHelpFrame functionality to wxHtmlHelpWindow to allow
[wxWidgets.git] / wxPython / demo / MDIWindows.py
1
2 import wx
3 import os
4 import sys
5
6 #----------------------------------------------------------------------
7
8 class TestPanel(wx.Panel):
9 def __init__(self, parent, log):
10 self.log = log
11 wx.Panel.__init__(self, parent, -1)
12
13 b1 = wx.Button(self, -1, "MDI demo")
14 self.Bind(wx.EVT_BUTTON, self.ShowMDIDemo, b1)
15
16 b2 = wx.Button(self, -1, "MDI with SashWindows demo")
17 self.Bind(wx.EVT_BUTTON, self.ShowMDISashDemo, b2)
18
19 box = wx.BoxSizer(wx.VERTICAL)
20 box.Add((20, 30))
21 box.Add(b1, 0, wx.ALIGN_CENTER|wx.ALL, 15)
22 box.Add(b2, 0, wx.ALIGN_CENTER|wx.ALL, 15)
23 self.SetAutoLayout(True)
24 self.SetSizer(box)
25
26
27 # These are spawned as new processes because on Mac there can be
28 # some problems related to having regular frames and MDI frames in
29 # the same app.
30 def ShowMDIDemo(self, evt):
31 exe, spawn = self.GetPyExecutable()
32 spawn(os.P_NOWAIT, exe, exe, "MDIDemo.py")
33
34 def ShowMDISashDemo(self, evt):
35 exe, spawn = self.GetPyExecutable()
36 spawn(os.P_NOWAIT, exe, exe, "MDISashDemo.py")
37
38
39 def GetPyExecutable(self):
40 if 'wxMac' in wx.PlatformInfo:
41 # sys.executable will be wrong if running the demo from
42 # an app bundle. Just find pythonw on the path instead.
43 return 'pythonw' + sys.version[:3], os.spawnlp
44 else:
45 return sys.executable, os.spawnl
46
47 #----------------------------------------------------------------------
48
49 def runTest(frame, nb, log):
50 win = TestPanel(nb, log)
51 return win
52
53 #----------------------------------------------------------------------
54
55
56
57 overview = """<html><body>
58 <h2><center>Multiple Document Interface</center></h2>
59
60 Although Microsoft has deprecated the MDI model, wxWindows still supports
61 it. Here are a couple samples of how to use it - one straightforward, the other
62 showing how the MDI interface can be integrated into a SashWindow interface.
63
64 </body></html>
65 """
66
67
68 if __name__ == '__main__':
69 import sys,os
70 import run
71 run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])