]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/samples/doodle/superdoodle.py
fixed deadlock when calling wxPostEvent() from worker thread
[wxWidgets.git] / wxPython / samples / doodle / superdoodle.py
index 98166911071c57ebbc5495ff4c6c2732ba626aa1..f2f24fecb6a9e1e2cfee1aa376e5e4ed69e1ceab 100644 (file)
@@ -57,8 +57,7 @@ class DoodleFrame(wx.Frame):
         box.Add(self.doodle, 1, wx.EXPAND)
 
         # Tell the frame that it should layout itself in response to
-        # size events.
-        self.SetAutoLayout(True)
+        # size events using this sizer.
         self.SetSizer(box)
 
 
@@ -107,12 +106,12 @@ class DoodleFrame(wx.Frame):
         menuBar.Append(menu2, "&Help")
         self.SetMenuBar(menuBar)
 
-        wx.EVT_MENU(self, idOPEN,   self.OnMenuOpen)
-        wx.EVT_MENU(self, idSAVE,   self.OnMenuSave)
-        wx.EVT_MENU(self, idSAVEAS, self.OnMenuSaveAs)
-        wx.EVT_MENU(self, idCLEAR,  self.OnMenuClear)
-        wx.EVT_MENU(self, idEXIT,   self.OnMenuExit)
-        wx.EVT_MENU(self, idABOUT,  self.OnMenuAbout)
+        self.Bind(wx.EVT_MENU,   self.OnMenuOpen, id=idOPEN)
+        self.Bind(wx.EVT_MENU,   self.OnMenuSave, id=idSAVE)
+        self.Bind(wx.EVT_MENU, self.OnMenuSaveAs, id=idSAVEAS)
+        self.Bind(wx.EVT_MENU,  self.OnMenuClear, id=idCLEAR)
+        self.Bind(wx.EVT_MENU,   self.OnMenuExit, id=idEXIT)
+        self.Bind(wx.EVT_MENU,  self.OnMenuAbout, id=idABOUT)
 
 
 
@@ -181,7 +180,7 @@ class ControlPanel(wx.Panel):
     BMP_BORDER = 3
 
     def __init__(self, parent, ID, doodle):
-        wx.Panel.__init__(self, parent, ID, style=wx.RAISED_BORDER)
+        wx.Panel.__init__(self, parent, ID, style=wx.RAISED_BORDER, size=(20,20))
 
         numCols = 4
         spacing = 4
@@ -202,7 +201,7 @@ class ControlPanel(wx.Panel):
             b = buttons.GenBitmapToggleButton(self, k, bmp, size=btnSize )
             b.SetBezelWidth(1)
             b.SetUseFocusIndicator(False)
-            wx.EVT_BUTTON(self, k, self.OnSetColour)
+            self.Bind(wx.EVT_BUTTON, self.OnSetColour, b)
             cGrid.Add(b, 0)
             self.clrBtns[colours[k]] = b
         self.clrBtns[colours[keys[0]]].SetToggle(True)
@@ -217,7 +216,7 @@ class ControlPanel(wx.Panel):
             b = buttons.GenToggleButton(self, x, str(x), size=btnSize)
             b.SetBezelWidth(1)
             b.SetUseFocusIndicator(False)
-            wx.EVT_BUTTON(self, x, self.OnSetThickness)
+            self.Bind(wx.EVT_BUTTON, self.OnSetThickness, b)
             tGrid.Add(b, 0)
             self.thknsBtns[x] = b
         self.thknsBtns[1].SetToggle(True)
@@ -295,9 +294,9 @@ class ColourIndicator(wx.Window):
     def __init__(self, parent):
         wx.Window.__init__(self, parent, -1, style=wx.SUNKEN_BORDER)
         self.SetBackgroundColour(wx.WHITE)
-        self.SetSize( (-1, 45) )
+        self.SetSize( (45, 45) )
         self.colour = self.thickness = None
-        wx.EVT_PAINT(self, self.OnPaint)
+        self.Bind(wx.EVT_PAINT, self.OnPaint)
 
 
     def Update(self, colour, thickness):
@@ -352,7 +351,7 @@ instructions: </p>
 
 <p><b>SuperDoodle</b> and <b>wxPython</b> are brought to you by
 <b>Robin Dunn</b> and <b>Total Control Software</b>, Copyright
-&copy; 1997-2003.</p>
+&copy; 1997-2006.</p>
 </body>
 </html>
 '''
@@ -399,5 +398,5 @@ class DoodleApp(wx.App):
 #----------------------------------------------------------------------
 
 if __name__ == '__main__':
-    app = DoodleApp(0)
+    app = DoodleApp(redirect=True)
     app.MainLoop()