Last active
March 7, 2024 21:05
-
-
Save vigilantPotato/57170f24154fbbb181dfc889d8b6bea5 to your computer and use it in GitHub Desktop.
how to use progressbar (determinate)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ctypes | |
import tkinter | |
from tkinter import ttk | |
#button function | |
def count_up(): | |
if var.get() < 100: | |
var.set(var.get() + 10) | |
else: | |
var.set(0) | |
if __name__ == "__main__": | |
ctypes.windll.shcore.SetProcessDpiAwareness(1) | |
root = tkinter.Tk() | |
#variable for counter | |
var = tkinter.IntVar(root) | |
#Progressbar(determinate) | |
pb = ttk.Progressbar( | |
root, | |
maximum=100, #maximum | |
mode="determinate", #determinate mode | |
variable=var, #counter | |
orient="horizontal",#orient | |
) | |
pb.pack() | |
#countup button | |
cb = tkinter.Button( | |
root, | |
text="count up", | |
command=count_up, | |
) | |
cb.pack() | |
root.mainloop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment