Skip to content

Instantly share code, notes, and snippets.

@vigilantPotato
Created March 7, 2024 21:05
Show Gist options
  • Save vigilantPotato/40fc841fbdfe42cc8d8318ebd25dac8e to your computer and use it in GitHub Desktop.
Save vigilantPotato/40fc841fbdfe42cc8d8318ebd25dac8e to your computer and use it in GitHub Desktop.
how to use progressbar (indeterminate)
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