-
Notifications
You must be signed in to change notification settings - Fork 26
/
whipFTP_PaneButton.py
24 lines (20 loc) · 852 Bytes
/
whipFTP_PaneButton.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
#Custom button class for whipFTP, Copyrights Vishnu Shankar B,
from tkinter import *
from tkinter import ttk
from tkinter import PhotoImage
class Button(ttk.Label):
def __init__(self, parent, name, icon, path, command):
#Save reference to path and function
self.path = path
self.path_function = command
#Create the label
super().__init__(parent, text = name, image = icon, compound = 'left')
super().pack(side = 'top', pady = 3, padx = 3, fill = X)
#Bind events
super().bind('<Button-1>', lambda path: self.path_function(self.path))
super().bind('<Enter>', self.hover)
super().bind('<Leave>', self.leave)
def hover(self, event):
super().configure(background = '#cfd6e6')
def leave(self, event):
super().configure(background = '#f5f6f7')