X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/edf3b4dcbaf8ad81b680e9abb3778dfbe2968f48..f78e4942ec0f3f6abd2992502e2d6c5c2e8e55f6:/wxPython/wx/lib/colourselect.py?ds=sidebyside diff --git a/wxPython/wx/lib/colourselect.py b/wxPython/wx/lib/colourselect.py index 62eee85e39..20fb0d0e35 100644 --- a/wxPython/wx/lib/colourselect.py +++ b/wxPython/wx/lib/colourselect.py @@ -104,8 +104,13 @@ class ColourSelect(wx.BitmapButton): def MakeBitmap(self): - bdr = 10 + bdr = 8 width, height = self.GetSize() + + # yes, this is weird, but it appears to work around a bug in wxMac + if "wxMac" in wx.PlatformInfo and width == height: + height -= 1 + bmp = wx.EmptyBitmap(width-bdr, height-bdr) dc = wx.MemoryDC() dc.SelectObject(bmp) @@ -133,7 +138,8 @@ class ColourSelect(wx.BitmapButton): self.SetBitmapDisabled(bmp) self.SetBitmapFocus(bmp) self.SetBitmapSelected(bmp) - + self.Refresh() + def OnChange(self): wx.PostEvent(self, ColourSelectEvent(self.GetId(), self.GetValue())) @@ -144,13 +150,12 @@ class ColourSelect(wx.BitmapButton): data = wx.ColourData() data.SetChooseFull(True) data.SetColour(self.colour) - dlg = wx.ColourDialog(self.GetParent(), data) + dlg = wx.ColourDialog(wx.GetTopLevelParent(self), data) changed = dlg.ShowModal() == wx.ID_OK if changed: data = dlg.GetColourData() self.SetColour(data.GetColour()) - dlg.Destroy() # moved after dlg.Destroy, since who knows what the callback will do...