]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/demo/Main.py
Use PlatformInfo
[wxWidgets.git] / wxPython / demo / Main.py
index fe35bbfdcaec565042c57899f73bf8db8cb03747..14abd512b706e680ad87358cd8e9ffb6eba12ae3 100644 (file)
@@ -38,6 +38,7 @@ _treeList = [
         'GridBagSizer',
         'Cursor',
         'PyPlot',
+        'ImageAlpha',
         ]),
 
     # managed windows == things with a (optional) caption you can close
@@ -193,6 +194,7 @@ _treeList = [
         'Cursor',
         'DragImage',
         'Image',
+        'ImageAlpha',
         'ImageFromStream',
         'Mask',
         'Throbber',
@@ -263,7 +265,7 @@ try:
     from StyledTextCtrl_2 import PythonSTC
     class DemoCodeViewer(PythonSTC):
         def __init__(self, parent, ID):
-            PythonSTC.__init__(self, parent, ID)
+            PythonSTC.__init__(self, parent, ID, wx.BORDER_NONE)
             self.SetUpEditor()
 
         # Some methods to make it compatible with how the wxTextCtrl is used
@@ -431,6 +433,7 @@ class wxPythonDemo(wx.Frame):
     def __init__(self, parent, id, title):
         wx.Frame.__init__(self, parent, -1, title, size = (800, 600),
                           style=wx.DEFAULT_FRAME_STYLE|wx.NO_FULL_REPAINT_ON_RESIZE)
+        
 
         self.cwd = os.getcwd()
         self.curOverview = ""
@@ -490,9 +493,15 @@ class wxPythonDemo(wx.Frame):
         # Make a File menu
         self.mainmenu = wx.MenuBar()
         menu = wx.Menu()
+        item = menu.Append(-1, '&Redirect Output',
+                           'Redirect print statements to a window',
+                           wx.ITEM_CHECK)
+        self.Bind(wx.EVT_MENU, self.OnToggleRedirect, item)
+        
         item = menu.Append(-1, 'E&xit\tAlt-X', 'Get the heck outta here!')
         self.Bind(wx.EVT_MENU, self.OnFileExit, item)
         wx.App_SetMacExitMenuItemId(item.GetId())
+
         self.mainmenu.Append(menu, '&File')
 
         # Make a Demo menu
@@ -684,7 +693,6 @@ class wxPythonDemo(wx.Frame):
         if itemText == self.overviewText:
             self.LoadDemoSource('Main.py')
             self.SetOverview(self.overviewText, overview)
-##            self.nb.Refresh();
             self.window = None
 
         else:
@@ -703,15 +711,10 @@ class wxPythonDemo(wx.Frame):
                     wx.EndBusyCursor()
                 self.tree.Refresh()
 
-                # in case runTest is modal, make sure things look right...
-##                self.nb.Refresh();
-##                wx.SafeYield()
-
                 self.window = module.runTest(self, self.nb, self) ###
                 if self.window is not None:
                     self.nb.AddPage(self.window, 'Demo')
                     self.nb.SetSelection(2)
-##                    self.nb.Refresh()  # without this wxMac has troubles showing the just added page
 
             else:
                 self.ovr.SetPage("")
@@ -746,6 +749,15 @@ class wxPythonDemo(wx.Frame):
     def OnFileExit(self, *event):
         self.Close()
 
+    def OnToggleRedirect(self, event):
+        app = wx.GetApp()
+        if event.Checked():
+            app.RedirectStdio()
+            print "Print statements and other standard output will now be directed to this window."
+        else:
+            app.RestoreStdio()
+            print "Print statements and other standard output will now be sent to the usual location."
+        
     def OnHelpAbout(self, event):
         from About import MyAboutBox
         about = MyAboutBox(self)