]> git.saurik.com Git - wxWidgets.git/commitdiff
Don't try to access a color not in the dictionary
authorRobin Dunn <robin@alldunn.com>
Sat, 23 Dec 2006 00:02:59 +0000 (00:02 +0000)
committerRobin Dunn <robin@alldunn.com>
Sat, 23 Dec 2006 00:02:59 +0000 (00:02 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44039 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

wxPython/samples/wxPIA_book/Chapter-06/example7.py

index 626827fbe014b1e0f4ef5e7c3034964a784f32cc..74f91ac4d8d598458e7c00fa138948a764c1b959 100644 (file)
@@ -188,7 +188,7 @@ class SketchFrame(wx.Frame):
         dlg.Destroy()
 
     def OnOtherColor(self, event):
         dlg.Destroy()
 
     def OnOtherColor(self, event):
-        dlg = wx.ColourDialog(frame)
+        dlg = wx.ColourDialog(self)
         dlg.GetColourData().SetChooseFull(True)
         if dlg.ShowModal() == wx.ID_OK:
             self.sketch.SetColor(dlg.GetColourData().GetColour())
         dlg.GetColourData().SetChooseFull(True)
         if dlg.ShowModal() == wx.ID_OK:
             self.sketch.SetColor(dlg.GetColourData().GetColour())
@@ -302,7 +302,7 @@ class ControlPanel(wx.Panel):
 
     def OnSetColour(self, event):
         color = self.colorMap[event.GetId()]
 
     def OnSetColour(self, event):
         color = self.colorMap[event.GetId()]
-        if color != self.sketch.color:
+        if color != self.sketch.color and self.sketch.color in self.colorButtons:
             self.colorButtons[self.sketch.color].SetToggle(False)
         self.sketch.SetColor(color)
 
             self.colorButtons[self.sketch.color].SetToggle(False)
         self.sketch.SetColor(color)