Skip to content

Instantly share code, notes, and snippets.

@LeeKamentsky
Created September 23, 2015 20:31
Show Gist options
  • Save LeeKamentsky/11eb5d9ad099622dc7d1 to your computer and use it in GitHub Desktop.
Save LeeKamentsky/11eb5d9ad099622dc7d1 to your computer and use it in GitHub Desktop.
Mac selection snippet
if sys.platform != 'darwin':
wx.RendererNative.Get().DrawItemSelectionRect(
window, dc, rect, flags)
elif flags & wx.CONTROL_SELECTED:
if flags & wx.CONTROL_FOCUSED:
color = wx.SystemSettings.GetColour(wx.SYS_COLOUR_HIGHLIGHT)
else:
color = wx.SystemSettings.GetColour(wx.SYS_COLOUR_INACTIVECAPTION)
old_brush = dc.Brush
new_brush = wx.Brush(color)
dc.Brush = new_brush
dc.Pen = wx.TRANSPARENT_PEN
dc.DrawRectangleRect(rect)
dc.Brush = old_brush
new_brush.Destroy()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment