Someone asked me how to create a progress bar using Python Tkinter. After research and experiment, I found several ways of representing the progress. In this tutorial, I will explain how to create a progress bar with examples and screenshots.
Progressbar Widget in Python Tkinter
The Progressbar widget in Tkinter is used to reassure the user that something is happening in the background. It can operate in two modes:
- Determinate mode: The progress bar shows the percentage of completion of a task.
- Indeterminate mode: The progress bar shows an animated effect to indicate that a process is ongoing, but the completion percentage is unknown.
The Progressbar widget is part of the ttk (themed Tk) module, which provides a set of themed widgets that look more modern compared to the classic Tkinter widgets.
Read How to Master the Python Tkinter Canvas?
Create a Progress Bar in Python Tkinter
To create a basic progress bar in Tkinter, follow these steps:
- Import the necessary modules:
import tkinter as tk
from tkinter import ttk- Create a Tkinter window:
window = tk.Tk()
window.title("Progress Bar Example")- Create a progress bar widget:
progress_bar = ttk.Progressbar(window, length=200, mode='determinate')
progress_bar.pack()- Start the Tkinter event loop:
window.mainloop()You can see the output in the screenshot below.

In this example, we create a progress bar with a length of 200 pixels and set its mode to ‘determinate’. The pack() method is used to add the progress bar to the window.
Check out How to Set and Manage Window Size in Python Tkinter?
Update the Progress Bar
To update the progress bar, you need to change its value attribute. Here’s an example that demonstrates how to update the progress bar based on a percentage:
import tkinter as tk
from tkinter import ttk
def update_progress_bar():
progress_bar['value'] += 10
if progress_bar['value'] < 100:
window.after(1000, update_progress_bar)
window = tk.Tk()
window.title("Progress Bar Update Example")
progress_bar = ttk.Progressbar(window, length=200, mode='determinate')
progress_bar.pack()
update_progress_bar()
window.mainloop()You can see the output in the screenshot below.

In this example, the update_progress_bar() function increments the progress bar’s value by 10 every second using the after() method. The function checks if the value is less than 100 before scheduling the next update.
Read How to Use the Tkinter Treeview Widget in Python?
Progress Bar with Start and Stop Buttons
Here’s an example that demonstrates how to create a progress bar with start and stop buttons:
import tkinter as tk
from tkinter import ttk
def start_progress():
if not progress_bar['value']:
progress_bar.start()
start_button['state'] = 'disabled'
stop_button['state'] = 'normal'
def stop_progress():
progress_bar.stop()
progress_bar['value'] = 0
start_button['state'] = 'normal'
stop_button['state'] = 'disabled'
window = tk.Tk()
window.title("Progress Bar with Buttons")
progress_bar = ttk.Progressbar(window, length=200, mode='indeterminate')
progress_bar.pack()
button_frame = ttk.Frame(window)
button_frame.pack()
start_button = ttk.Button(button_frame, text="Start", command=start_progress)
start_button.pack(side='left')
stop_button = ttk.Button(button_frame, text="Stop", command=stop_progress, state='disabled')
stop_button.pack(side='left')
window.mainloop()You can see the output in the screenshot below.

In this example:
- The
start_progress()function starts the progress bar and disables the start button while enabling the stop button. - The
stop_progress()function stops the progress bar, resets its value, enables the start button, and disables the stop button. - The progress bar is set to ‘indeterminate’ mode, which shows an animated effect.
Check out How to Take User Input and Store It in a Variable Using Python Tkinter?
Customize the Progress Bar
You can customize the appearance of the progress bar using various options. Here are some common customization options:
| Option | Description |
|---|---|
| length | The length of the progress bar in pixels |
| mode | The mode of the progress bar (‘determinate’ or ‘indeterminate’) |
| maximum | The maximum value of the progress bar (default is 100) |
| value | The current value of the progress bar |
| orient | The orientation of the progress bar (‘horizontal’ or ‘vertical’) |
For example, to create a vertical progress bar with a maximum value of 50, you can use:
progress_bar = ttk.Progressbar(window, orient='vertical', length=100, maximum=50, mode='determinate')Read How to Read a Text File and Display the Contents in a Tkinter With Python?
Conclusion
In this tutorial, I have explained how to create a progress bar using Python Tkinter. I discussed creating a progress bar, updating a progress bar, and progress bar with start and stop buttons, and customizing the progress bar.
You may like to read:
- How to Upload a File in Python Tkinter?
- How to Navigate Between Pages in a Python Tkinter?
- How to Implement Drag and Drop Functionality in Python Tkinter?

I am Bijay Kumar, a Microsoft MVP in SharePoint. Apart from SharePoint, I started working on Python, Machine learning, and artificial intelligence for the last 5 years. During this time I got expertise in various Python libraries also like Tkinter, Pandas, NumPy, Turtle, Django, Matplotlib, Tensorflow, Scipy, Scikit-Learn, etc… for various clients in the United States, Canada, the United Kingdom, Australia, New Zealand, etc. Check out my profile.