Created
March 7, 2024 21:05
-
-
Save vigilantPotato/40fc841fbdfe42cc8d8318ebd25dac8e to your computer and use it in GitHub Desktop.
how to use progressbar (indeterminate)
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 start_progressbar(): | |
if cb["text"] == "start": | |
pb.start(interval=10) | |
cb["text"] = "stop" | |
else: | |
pb.stop() | |
cb["text"] = "start" | |
if __name__ == "__main__": | |
ctypes.windll.shcore.SetProcessDpiAwareness(1) | |
root = tkinter.Tk() | |
#variable for counter | |
var = tkinter.IntVar(root) | |
#Progressbar(indeterminate) | |
pb = ttk.Progressbar( | |
root, | |
mode="indeterminate", #indeterminate mode | |
orient="horizontal", #orient | |
) | |
pb.pack() | |
#countup button | |
cb = tkinter.Button( | |
root, | |
text="start", | |
command=start_progressbar, | |
) | |
cb.pack() | |
root.mainloop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment