-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwidgets.py
44 lines (32 loc) · 1.29 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
30
31
32
33
34
35
36
37
38
39
40
41
42
try:
import Tkinter as tk
except ImportError:
import tkinter as tk
class LabeledEntry(tk.Frame):
def __init__(self, master, text, variable, label_width=None,
entry_width=None, *args, **kwargs):
tk.Frame.__init__(self, *args, **kwargs)
self.variable = variable
self.text = text
self.master = master
tk.Label(self.master,
text=text,
width=label_width).pack(side=tk.LEFT)
self.entry = tk.Entry( self.master, textvariable=variable, width=entry_width)
self.entry.pack(side=tk.LEFT)
class LabeledCheckbutton(tk.Frame):
def __init__(self, master, label, command, label_width=None, *args, **kwargs):
tk.Frame.__init__(self, *args, **kwargs)
self.master = master
self.colorA = '#00fa32'
self.colorB = 'black'
self.variable = tk.IntVar(self.master)
self.check_button = tk.Checkbutton(self.master,
variable=self.variable,
command=command,
bg=self.colorB)
self.check_button.pack(side=tk.LEFT)
tk.Label(self.master, text=label,
fg=self.colorA, bg=self.colorB,
width=label_width)\
.pack(side=tk.LEFT)