Adding a progressbar to the GUI
In this recipe, we will add a Progressbar
to our GUI. It is very easy to add a ttk.Progressbar
, and we will demonstrate how to start and stop a Progressbar
. This recipe will also show you how to delay the stopping of a Progressbar
and how to run it in a loop.
Note
Progressbar
is typically used to show the current status of a long-running process.
Getting ready
We will add the progressbar to Tab 2
of the GUI that we developed in the previous recipe: Creating tooltips using Python.
How to do it…
First, we add four buttons into LabelFrame
on Tab 2
, replacing the labels that were there before. We set the Labelframe
text property to ProgressBar
.
We then place a ttk.Progressbar
widget below all other widgets on Tab 2
and align this new widget with the other widgets.
Our GUI now looks as follows:
GUI_progressbar.py

We connect each of our four new buttons to a new callback function, which we assign to their command property:

Note
Clicking the Run Progressbar
button will run...