]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/MDIWindows.py
6 #----------------------------------------------------------------------
8 class TestPanel(wx
.Panel
):
9 def __init__(self
, parent
, log
):
11 wx
.Panel
.__init
__(self
, parent
, -1)
13 b1
= wx
.Button(self
, -1, "MDI demo")
14 self
.Bind(wx
.EVT_BUTTON
, self
.ShowMDIDemo
, b1
)
16 b2
= wx
.Button(self
, -1, "MDI with SashWindows demo")
17 self
.Bind(wx
.EVT_BUTTON
, self
.ShowMDISashDemo
, b2
)
19 box
= wx
.BoxSizer(wx
.VERTICAL
)
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)
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
30 def ShowMDIDemo(self
, evt
):
31 exe
, spawn
= self
.GetPyExecutable()
32 spawn(os
.P_NOWAIT
, exe
, exe
, "MDIDemo.py")
34 def ShowMDISashDemo(self
, evt
):
35 exe
, spawn
= self
.GetPyExecutable()
36 spawn(os
.P_NOWAIT
, exe
, exe
, "MDISashDemo.py")
38 # TODO: This hack can be removed once we fix the way the Python
39 # app bundles are generated so that they are not bundling and
40 # pointing to an otherwise unused and non-GUI-friendly version of
42 def GetPyExecutable(self
):
43 if 'wxMac' in wx
.PlatformInfo
:
44 # sys.executable will be wrong if running the demo from
45 # an app bundle. But the bundle is always using a system
46 # framework so just hardcode the path to it.
47 if sys
.version
[:3] == "2.4":
48 return '/usr/local/bin/pythonw', os
.spawnl
50 return '/usr/bin/pythonw', os
.spawnl
52 return sys
.executable
, os
.spawnl
54 #----------------------------------------------------------------------
56 def runTest(frame
, nb
, log
):
57 win
= TestPanel(nb
, log
)
60 #----------------------------------------------------------------------
64 overview
= """<html><body>
65 <h2><center>Multiple Document Interface</center></h2>
67 Although Microsoft has deprecated the MDI model, wxWindows still supports
68 it. Here are a couple samples of how to use it - one straightforward, the other
69 showing how the MDI interface can be integrated into a SashWindow interface.
75 if __name__
== '__main__':
78 run
.main(['', os
.path
.basename(sys
.argv
[0])] + sys
.argv
[1:])