X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4e4a10ba27b06cca2555b989bd05a0af08eb0237..0a5bb138a71dfc1c706fc0858fb2801500e2c2e8:/wxPython/wx/lib/colourselect.py?ds=sidebyside diff --git a/wxPython/wx/lib/colourselect.py b/wxPython/wx/lib/colourselect.py index f71329967e..5edba11b67 100644 --- a/wxPython/wx/lib/colourselect.py +++ b/wxPython/wx/lib/colourselect.py @@ -32,6 +32,12 @@ # o Updated for 2.5 compatability. # +""" +Provides a `ColourSelect` button that, when clicked, will display a +colour selection dialog. The selected colour is displayed on the +button itself. +""" + #---------------------------------------------------------------------------- import wx @@ -54,7 +60,7 @@ EVT_COLOURSELECT = wx.PyEventBinder(wxEVT_COMMAND_COLOURSELECT, 1) #---------------------------------------------------------------------------- class ColourSelect(wx.BitmapButton): - def __init__(self, parent, id, label="", colour=wx.BLACK, + def __init__(self, parent, id=wx.ID_ANY, label="", colour=wx.BLACK, pos=wx.DefaultPosition, size=wx.DefaultSize, callback=None, style=0): if label: @@ -104,8 +110,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)