]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/demo/MDIWindows.py
Integrated fixes for sizing/positioning; cleanup; removal of handle/window
[wxWidgets.git] / wxPython / demo / MDIWindows.py
index fb68174246e152ca6f18a87ab7d07c8cbc2c8ac4..2f75d8e3ddf9329b6cbcdc8bd161ad144ccfdc2a 100644 (file)
@@ -1,8 +1,7 @@
 
 import  wx
-
-import  MDIDemo
-import  MDISashDemo
+import os
+import sys
 
 #----------------------------------------------------------------------
 
@@ -25,16 +24,26 @@ class TestPanel(wx.Panel):
         self.SetSizer(box)
 
 
+    # These are spawned as new processes because on Mac there can be
+    # some problems related to having regular frames and MDI frames in
+    # the same app.
     def ShowMDIDemo(self, evt):
-        frame = MDIDemo.MyParentFrame()
-        frame.Show()
+        exe, spawn = self.GetPyExecutable()
+        spawn(os.P_NOWAIT, exe, exe, "MDIDemo.py")
 
     def ShowMDISashDemo(self, evt):
-        frame = MDISashDemo.MyParentFrame()
-        frame.Show()
-
-
-
+        exe, spawn = self.GetPyExecutable()
+        spawn(os.P_NOWAIT, exe, exe, "MDISashDemo.py")
+
+
+    def GetPyExecutable(self):
+        if 'wxMac' in wx.PlatformInfo:
+            # sys.executable will be wrong if running the demo from
+            # an app bundle.  Just find pythonw on the path instead.
+            return 'pythonw' + sys.version[:3], os.spawnlp
+        else:
+            return sys.executable, os.spawnl
+        
 #----------------------------------------------------------------------
 
 def runTest(frame, nb, log):
@@ -59,4 +68,4 @@ showing how the MDI interface can be integrated into a SashWindow interface.
 if __name__ == '__main__':
     import sys,os
     import run
-    run.main(['', os.path.basename(sys.argv[0])])
+    run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])