Progressbar widget in Python Tkinter

The progressbar is a common GUI element which is used to show the progress of certain task. In tis article we will see how to create a progressbar using the Python tkinter GUI library.

In the below program we have imported the progressbar sub-module of tkinter.ttk module. Then used the style object to create the style options and supply the value for the length of the button as well as value of the progress.


import tkinter as tk
from tkinter.ttk import Progressbar
from tkinter import ttk
canv = tk.Tk()
canv.title("Tkinter Progressbar")
style = ttk.Style()
style.configure("grey.Horizontal.TProgressbar", background='blue')
bar = Progressbar(canv, length=180, style='grey.Horizontal.TProgressbar')
bar['value'] = 50
bar.grid(column=0, row=0)


Running the above code gives us the following result −