Make sure the default button face color is not one with a fully transparent alpha

This commit is contained in:
Robin Dunn
2019-10-07 20:38:01 -07:00
parent 0c1a594344
commit 47c24c96e5
2 changed files with 7 additions and 3 deletions

View File

@@ -172,7 +172,11 @@ class GenButton(wx.Control):
self.SetLabel(label)
self.InheritAttributes()
self.SetInitialSize(size)
self.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNFACE))
face = wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNFACE)
if 'wxMac' in wx.PlatformInfo and face.alpha == 0:
face = wx.SystemSettings.GetColour(wx.SYS_COLOUR_3DLIGHT)
assert face.alpha != 0, "a different default system colour is needed!"
self.SetBackgroundColour(face)
self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
self.Bind(wx.EVT_LEFT_UP, self.OnLeftUp)

View File

@@ -149,8 +149,8 @@ class CustomColourData(object):
class ColourSelect(wx.lib.buttons.GenBitmapButton):
"""
A subclass of :class:`wx.BitmapButton` that, when clicked, will
display a colour selection dialog.
A subclass of :class:`wx.lib.buttons.GenBitmapButton` that,
when clicked, will display a colour selection dialog.
"""
def __init__(self, parent, id=wx.ID_ANY, label="", colour=wx.BLACK,