-
Notifications
You must be signed in to change notification settings - Fork 0
/
Scale.py
111 lines (71 loc) · 1.59 KB
/
Scale.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
from tkinter import *
#function
def check():
value = scale.get()
label.config(text = f'{value} deg. celsius')
def add():
scale.set(scale.get() +5)
value = scale.get()
if value >= 25 and value <= 49:
scale.config(troughcolor = 'blue')
elif value >= 50 and value <= 69:
scale.config(troughcolor = 'orange')
elif value >= 70 and value <= 100:
scale.config(troughcolor = 'red')
else:
scale.config(troughcolor = 'lightblue')
def minus():
scale.set(scale.get() -5)
value = scale.get()
if value >= 25 and value <= 49:
scale.config(troughcolor = 'blue')
elif value >= 50 and value <= 69:
scale.config(troughcolor = 'orange')
elif value >= 70 and value <= 100:
scale.config(troughcolor = 'red')
else:
scale.config(troughcolor = 'lightblue')
#window
window = Tk()
window.config(padx =50)
window.config(pady =50)
#add button
addb = Button(window,
text = '+',
font = ('Comic Sans', 15, 'bold'),
command = add,
)
addb.pack()
#scale
scale = Scale(window,
from_ = 100,
to = 0,
width = 50,
length = 500,
tickinterval = 10,
resolution = 5,
troughcolor = 'lightblue',
#orient = HORIZONTAL
)
scale.pack()
#add button
minusb = Button(window,
text = '-',
font = ('Comic Sans', 20, 'bold'),
command = minus,
)
minusb.pack()
#check button
button = Button(window,
text = 'check',
font = ('Comic Sans', 10),
command = check,
)
button.pack()
#label
label = Label(window,
text='',
font = ('Comic Sans', 15),
)
label.pack()
window.mainloop()