]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/demo/ColourDB.py
Patch [ 1314868 ] [wxMSW] Show MDI child menubars when ShowFullScreen(false)
[wxWidgets.git] / wxPython / demo / ColourDB.py
index 3db76c0a06c10041bddbfdcefb8a5ae19495e494..3c6c82352060c7db692baba745c2e9f27e7b8ade 100644 (file)
@@ -1,16 +1,6 @@
-# 11/4/03 - grimmtooth@softhome.net (Jeff Grimmett)
-#
-# o Updated to use wx namespace
-#
-# 11/24/03 - grimmtooth@softhome.net (Jeff Grimmett)
-#
-# o Had to move the call to wx.updateColourDB()
-# o Updated several places to change discrete pos and size parameters
-#   into two-tuples.
-#
 
 import wx
-import wx.lib.colourdb as cdb
+import wx.lib.colourdb
 
 import images
 
@@ -22,16 +12,12 @@ class TestWindow(wx.ScrolledWindow):
         wx.ScrolledWindow.__init__(self, parent, -1)
 
         # Populate our color list
-        self.clrList = cdb.getColourList()
+        self.clrList = wx.lib.colourdb.getColourList()
 
         # Just for style points, we'll use this as a background image.
         #self.clrList.sort()
         self.bg_bmp = images.getGridBGBitmap()
 
-        # Event handlers
-        self.Bind(wx.EVT_PAINT, self.OnPaint)
-        self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
-
         # This could also be done by getting the window's default font;
         # either way, we need to have a font loaded for later on.
         #self.SetBackgroundColour("WHITE")
@@ -64,6 +50,11 @@ class TestWindow(wx.ScrolledWindow):
         self.SetScrollbars(
             self.cellWidth, self.lineHeight, numCells, len(self.clrList) + 2
             )
+            
+        # Event handlers - moved here so events won't fire before init is 
+        # finished.
+        self.Bind(wx.EVT_PAINT, self.OnPaint)
+        self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
 
 
     # tile the background bitmap loaded in __init__()
@@ -82,7 +73,7 @@ class TestWindow(wx.ScrolledWindow):
         while x < sz.width:
             y = -dy
             while y < sz.height:
-                dc.DrawBitmap(self.bg_bmp, (x, y))
+                dc.DrawBitmap(self.bg_bmp, x, y)
                 y = y + h
 
             x = x + w
@@ -130,13 +121,12 @@ class TestWindow(wx.ScrolledWindow):
             clr = colours[line]
             y = (line+1) * self.lineHeight + 2
 
-            # Updated for 2.5 - now takes tuple for pos
-            dc.DrawText(clr, (self.cellWidth, y))
+            dc.DrawText(clr, self.cellWidth, y)
 
             brush = wx.Brush(clr, wx.SOLID)
             dc.SetBrush(brush)
-            dc.DrawRectangle((12 * self.cellWidth, y),
-                             (6 * self.cellWidth, self.textHeight))
+            dc.DrawRectangle(12 * self.cellWidth, y,
+                             6 * self.cellWidth, self.textHeight)
 
         dc.EndDrawing()
 
@@ -165,7 +155,7 @@ def runTest(frame, nb, log):
     # Note 11/24/03 - jg - I moved this into runTest() because
     # there must be a wx.App existing before this function
     # can be called - this is a change from 2.4 -> 2.5.
-    cdb.updateColourDB()
+    wx.lib.colourdb.updateColourDB()
 
     win = TestPanel(nb)
 
@@ -206,5 +196,5 @@ Trying to do otherwise will cause an exception to be raised.
 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:])