]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/demo/SplitTree.py
Themed backgrounds for flat generic buttons
[wxWidgets.git] / wxPython / demo / SplitTree.py
index c7666ef8165dcfa9307e3be3b9bc1b35a6a183a5..bf88d3a60d9dada4aa8555cbb41706cd7fa232c3 100644 (file)
@@ -48,10 +48,6 @@ class TestValueWindow(gizmos.TreeCompanionWindow):
     def __init__(self, parent, style=0):
         gizmos.TreeCompanionWindow.__init__(self, parent, -1, style=style)
         self.SetBackgroundColour("WHITE")
-        self.Bind(wx.EVT_ERASE_BACKGROUND, self.OEB)
-
-    def OEB(self, evt):
-        pass
 
     # This method is called to draw each item in the value window
     def DrawItem(self, dc, itemId, rect):
@@ -73,19 +69,19 @@ class TestValueWindow(gizmos.TreeCompanionWindow):
 
             dc.SetPen(pen)
             dc.SetBrush(wx.Brush(self.GetBackgroundColour(), wx.SOLID))
-            dc.DrawRectangle((rect.x, rect.y), (rect.width+1, rect.height+1))
+            dc.DrawRectangle(rect.x, rect.y, rect.width+1, rect.height+1)
             dc.SetTextForeground("BLACK")
             dc.SetBackgroundMode(wx.TRANSPARENT)
             tw, th = dc.GetTextExtent(text)
             x = 5
             y = rect.y + max(0, (rect.height - th) / 2)
-            dc.DrawText(text, (x, y))
+            dc.DrawText(text, x, y)
 
 
 
 class TestPanel(wx.Panel):
     def __init__(self, parent, log):
-        wx.Panel.__init__(self, parent, -1)
+        wx.Panel.__init__(self, parent, -1, size=(640,480))
         self.log = log
 
         scroller = gizmos.SplitterScrolledWindow(
@@ -105,7 +101,7 @@ class TestPanel(wx.Panel):
 
         valueWindow = TestValueWindow(splitter, style=wx.NO_BORDER)
 
-        splitter.SplitVertically(tree, valueWindow, 150)
+        wx.CallAfter(splitter.SplitVertically, tree, valueWindow, 150)
         scroller.SetTargetWindow(tree)
         scroller.EnableScrolling(False, False)
 
@@ -114,16 +110,17 @@ class TestPanel(wx.Panel):
 
         sizer = wx.BoxSizer(wx.VERTICAL)
         sizer.Add(scroller, 1, wx.EXPAND|wx.ALL, 25)
-        self.SetAutoLayout(True)
         self.SetSizer(sizer)
-
+        self.Layout()
 
 #----------------------------------------------------------------------
 
 def runTest(frame, nb, log):
     if wx.Platform == "__WXMAC__":
-        wx.MessageBox("This demo currently fails on the Mac. The problem is being looked into...", "Sorry")
-        return
+        from Main import MessagePanel
+        win = MessagePanel(nb, 'This demo currently fails on the Mac. The problem is being looked into...',
+                           'Sorry', wx.ICON_WARNING)
+        return win
 
     win = TestPanel(nb, log)
     return win
@@ -145,5 +142,5 @@ also be useful by themselves.
 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:])