1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-13 07:47:14 +03:00

Add ColoredButton for colored backgrounds

This commit is contained in:
Jonathan Harris 2016-02-01 02:06:22 +00:00
parent bcac7e30d8
commit c151396e4e

View File

@ -90,6 +90,22 @@ class Button(platform == 'darwin' and tk.Button or ttk.Button):
else:
ttk.Button.__init__(self, master, **kw)
class ColoredButton(platform == 'darwin' and tk.Label or tk.Button):
def __init__(self, master=None, **kw):
if platform == 'darwin':
# Can't set Button background on OSX, so use a Label instead
kw['relief'] = kw.pop('relief', tk.RAISED)
self._command = kw.pop('command', None)
tk.Label.__init__(self, master, **kw)
self.bind('<Button-1>', self._press)
else:
tk.Button.__init__(self, master, **kw)
if platform == 'darwin':
def _press(self, event):
self._command()
class Checkbutton(platform == 'darwin' and tk.Checkbutton or ttk.Checkbutton):
def __init__(self, master=None, **kw):