66 lines
1.5 KiB
Python
Executable File
66 lines
1.5 KiB
Python
Executable File
#!/usr/bin/python3
|
|
|
|
import tkinter as tk
|
|
from tkinter import ttk
|
|
|
|
# Create the root window
|
|
root = tk.Tk()
|
|
root.title("Mongometer")
|
|
|
|
def update_progress(value):
|
|
progress_var.set(value)
|
|
progress_bar["value"] = value
|
|
root.update_idletasks()
|
|
|
|
def start_progress():
|
|
middle_value = int(scale.get())
|
|
|
|
for i in range(1, middle_value + 1):
|
|
update_progress(i)
|
|
root.after(10) # Add a small delay for smoother animation
|
|
|
|
for i in range(middle_value - 1, 0, -1):
|
|
update_progress(i)
|
|
root.after(10)
|
|
|
|
def show_value(value):
|
|
value = int(value)
|
|
x, y = scale.coords()
|
|
value_label["text"] = 100 - abs(value), "%"
|
|
value_label.place(x=scale.winfo_x()+x, y=scale.winfo_y(), anchor="s")
|
|
|
|
def display_text_east(root, text):
|
|
label = tk.Label(root, text=text)
|
|
label.pack(side=tk.RIGHT)
|
|
|
|
def display_text_west(root, text):
|
|
label = tk.Label(root, text=text)
|
|
label.pack(side=tk.LEFT)
|
|
|
|
|
|
# Create a label to display text
|
|
text_label = tk.Label(root, text="Grad der Behinderung")
|
|
text_label.pack(pady=10)
|
|
|
|
value_label = tk.Label(root, font=("", 8))
|
|
|
|
scale_label = tk.Label(root)
|
|
scale_label.pack()
|
|
|
|
scale = tk.Scale(root, from_=-100, to=100, orient="horizontal", length=300, sliderlength=10,
|
|
showvalue=0, command=show_value)
|
|
scale.set(-100)
|
|
scale.pack()
|
|
|
|
progress_var = tk.DoubleVar()
|
|
|
|
# Display text on the east side
|
|
gender_to_display = "Männlich"
|
|
display_text_east(root, gender_to_display)
|
|
|
|
gender_to_display = "Weiblich"
|
|
display_text_west(root, gender_to_display)
|
|
|
|
|
|
root.mainloop()
|