Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tkinter import *
- from tkinter import ttk
- class App(Tk):
- def __init__(self):
- super().__init__()
- self.title("Progressbar")
- self.geometry("500x200")
- self._state = False
- self.value_var1 = IntVar()
- self.value_var2 = IntVar()
- # вертикальный Progressbar
- self.vpb = ttk.Progressbar(orient="vertical",
- length=100,
- value=0,
- maximum=15.0,
- variable=self.value_var1)
- self.vpb.pack(pady=5)
- # горизонтальный Progressbar
- self.hpb = ttk.Progressbar(orient="horizontal",
- length=150,
- value=0,
- maximum=10.0,
- variable=self.value_var2)
- self.hpb.pack(pady=5)
- self.button = ttk.Button(self, text="Start", command=self.on_click)
- self.button.pack()
- def on_click(self):
- self._state = not self._state
- if self._state:
- self.value_var1.set(0)
- self.value_var2.set(0)
- self.button["text"] = "Stop"
- self.vpb.start(1000)
- self.hpb.start(1000)
- else:
- self.button["text"] = "Start"
- self.vpb.stop()
- self.hpb.stop()
- App().mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement