-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathflood.py
52 lines (35 loc) · 1.12 KB
/
flood.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
from tkinter import *
import ttkbootstrap as tb
root = tb.Window(themename="superhero")
#root = Tk()
root.title("TTK Bootstrap! Floodgauge")
root.iconbitmap('images/codemy.ico')
root.geometry('500x550')
def starter():
# Start the guage
my_gauge.start()
while my_gauge.variable.get() < 80:
my_label.config(text=f"Position: {my_gauge.variable.get()}")
def stopper():
my_gauge.stop()
def incrementer():
my_gauge.step(10)
my_label.config(text=f"Position: {my_gauge.variable.get()}")
my_gauge = tb.Floodgauge(root, bootstyle="success",
font=("Helvetica", 18),
mask="Pos: {}%",
maximum=80,
orient="horizontal",
value=0,
mode="determinate"
)
my_gauge.pack(pady=50, fill=X, padx=20)
start_button = tb.Button(root, text="Start", bootstyle="danger outline", command=starter)
start_button.pack(pady=20)
stop_button = tb.Button(root, text="Stop", bootstyle="danger outline", command=stopper)
stop_button.pack(pady=20)
inc_button = tb.Button(root, text="Increment", bootstyle="danger outline", command=incrementer)
inc_button.pack(pady=20)
my_label = tb.Label(root, text="Position: ")
my_label.pack(pady=20)
root.mainloop()