/
Widgets.py
executable file
·30 lines (25 loc) · 1.01 KB
/
Widgets.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import tkinter
class customFlatButton(tkinter.Button):
''' - Class for custom-style button
- Meant to be used in tkinter frame, labelframe
- and everywhere tkinter.Button can be used
- Author(s): @author1 (See authors.txt file)
'''
def __init__(self, master, text, backgroundColor, buttonTextColor = 'black', accentColor = 'Whith', command = None):
super().__init__(
master = master,
text = text,
background = backgroundColor,
foreground = buttonTextColor,
activebackground = accentColor,
relief = tkinter.FLAT,
command = command
)
self.accentColor = accentColor,
self.backgroundColor = backgroundColor
self.bind('<Enter>', self._onEnter)
self.bind('<Leave>', self._onLeave)
def _onEnter(self, event):
self.configure(background = self.accentColor)
def _onLeave(self, event):
self.configure(background = self.backgroundColor)