]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/demo/Main.py
Always set background colour prior to any HTML rendering (this fixes assert in GTK2...
[wxWidgets.git] / wxPython / demo / Main.py
index fd557f017143de88014f28aa0d6bde37bcfdccd2..e353972a2db9c4db04c5811eb2b6adb4cfb5d151 100644 (file)
@@ -18,6 +18,16 @@ import wx.html
 
 import images
 
+##wx.Trap()
+##raw_input("Press a key...")
+
+
+# Use Python's bool constants if available, make aliases if not
+try:
+    True
+except NameError:
+    True = 1==1
+    False = 1==0
 
 #---------------------------------------------------------------------------
 
@@ -25,14 +35,11 @@ import images
 _treeList = [
     # new stuff
     ('Recent Additions', [
-        'wxScrolledPanel',
-        'ShapedWindow',
-        'NewNamespace',
-        'PopupMenu',
-        'AnalogClockWindow',
-        'MaskedEditControls',
-        'wxTreeListCtrl',
-        'wxGrid_MegaExample',
+        'wxVListBox',
+        'wxListbook',
+        'wxMaskedNumCtrl',
+        'FloatCanvas',
+        'wxXmlResourceSubclass',
         ]),
 
     # managed windows == things with a (optional) caption you can close
@@ -80,6 +87,7 @@ _treeList = [
         'wxGenericDirCtrl',
         'wxGrid',
         'wxGrid_MegaExample',
+        'wxListbook',
         'wxListBox',
         'wxListCtrl',
         'wxListCtrl_virtual',
@@ -104,7 +112,7 @@ _treeList = [
         'wxValidator',
         ]),
 
-    # controls coming from other librairies
+    # controls coming from other libraries
     ('More Windows/Controls', [
         #'wxFloatBar',          deprecated
         #'wxMVCTree',           deprecated
@@ -113,6 +121,7 @@ _treeList = [
         'ColourSelect',
         'ContextHelp',
         'FancyText',
+        'FloatCanvas',
         'FileBrowseButton',
         'GenericButtons',
         'MaskedEditControls',
@@ -132,12 +141,14 @@ _treeList = [
         'wxIntCtrl',
         'wxLEDNumberCtrl',
         'wxMimeTypesManager',
+        'wxMaskedNumCtrl',
         'wxMultiSash',
         'wxPopupControl',
         'wxStyledTextCtrl_1',
         'wxStyledTextCtrl_2',
         'wxTimeCtrl',
         'wxTreeListCtrl',
+        'wxVListBox',
         ]),
 
     # How to lay out the controls in a frame/dialog
@@ -150,6 +161,7 @@ _treeList = [
         'wxScrolledPanel',
         'wxXmlResource',
         'wxXmlResourceHandler',
+        'wxXmlResourceSubclass',
         ]),
 
     # ditto
@@ -187,7 +199,9 @@ _treeList = [
         'DialogUnits',
         'DrawXXXList',
         'FontEnumerator',
+        'NewNamespace',
         'PrintFramework',
+        'ShapedWindow',
         'Throbber',
         'Unicode',
         'wxFileHistory',
@@ -213,6 +227,7 @@ _treeList = [
 
 
 #---------------------------------------------------------------------------
+# Show how to derive a custom wxLog class
 
 class MyLog(wx.PyLog):
     def __init__(self, textCtrl, logTime=0):
@@ -236,6 +251,7 @@ class MyTP(wx.PyTipProvider):
 # A class to be used to display source code in the demo.  Try using the
 # wxSTC in the wxStyledTextCtrl_2 sample first, fall back to wxTextCtrl
 # if there is an error, such as the stc module not being present.
+#
 
 try:
     ##raise ImportError
@@ -328,12 +344,12 @@ class wxPythonDemo(wx.Frame):
         self.Centre(wx.BOTH)
         self.CreateStatusBar(1, wx.ST_SIZEGRIP)
 
-        splitter = wx.SplitterWindow(self, -1, style=wx.NO_3D|wx.SP_3D)
-        splitter2 = wx.SplitterWindow(splitter, -1, style=wx.NO_3D|wx.SP_3D)
+        splitter = wx.SplitterWindow(self, -1)
+        splitter2 = wx.SplitterWindow(splitter, -1)
 
         def EmptyHandler(evt): pass
-        wx.EVT_ERASE_BACKGROUND(splitter, EmptyHandler)
-        wx.EVT_ERASE_BACKGROUND(splitter2, EmptyHandler)
+        #wx.EVT_ERASE_BACKGROUND(splitter, EmptyHandler)
+        #wx.EVT_ERASE_BACKGROUND(splitter2, EmptyHandler)
 
         # Prevent TreeCtrl from displaying all items after destruction when True
         self.dying = False
@@ -394,9 +410,8 @@ class wxPythonDemo(wx.Frame):
         # Create a TreeCtrl
         tID = wx.NewId()
         self.treeMap = {}
-        self.tree = wx.TreeCtrl(splitter, tID,
-                                style=wx.TR_HAS_BUTTONS |
-                                wx.TR_HAS_VARIABLE_ROW_HEIGHT
+        self.tree = wx.TreeCtrl(splitter, tID, style =
+                                wx.TR_DEFAULT_STYLE #| wx.TR_HAS_VARIABLE_ROW_HEIGHT
                                )
 
         root = self.tree.AddRoot("wxPython Overview")
@@ -465,13 +480,21 @@ class wxPythonDemo(wx.Frame):
 
 
         # add the windows to the splitter and split it.
-        splitter2.SplitHorizontally(self.nb, self.log, 450)
+        splitter2.SplitHorizontally(self.nb, self.log, -120)
         splitter.SplitVertically(self.tree, splitter2, 180)
 
         splitter.SetMinimumPaneSize(20)
         splitter2.SetMinimumPaneSize(20)
 
 
+        # Make the splitter on the right expand the top wind when resized
+        def SplitterOnSize(evt):
+            splitter = evt.GetEventObject()
+            sz = splitter.GetSize()
+            splitter.SetSashPosition(sz.height - 120, False)
+            evt.Skip()
+        wx.EVT_SIZE(splitter2, SplitterOnSize)
+
 
         # select initial items
         self.nb.SetSelection(0)
@@ -808,7 +831,7 @@ platform GUI library, which is written in C++.
 <p> Like Python and wxWindows, wxPython is <b>Open Source</b> which
 means that it is free for anyone to use and the source code is
 available for anyone to look at and modify.  Or anyone can contribute
-fixes or enhnacments to the project.
+fixes or enhancements to the project.
 
 <p> wxPython is a <b>cross-platform</b> toolkit.  This means that the
 same program will run on multiple platforms without modification.