Preview:
import tkinter as tk
from tkinter import ttk

root = tk.Tk()

root.geometry('200x200')



progress_bar = ttk.Progressbar(root, length=100, value=2)
progress_bar.pack()


def test_func():
    for i, n in enumerate([1000, 2000, 500], start=1):
        for j in range(n):
            print(j)
        progress_bar.config({'value': (i/3) * 100})
        progress_bar.update()

test_func()
root.mainloop()
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter