Connecting threads with a progress bar
Progress bars are useful indicators of the status of a background task, showing an incrementally filled portion of the bar relative to the progress. They are frequently used in long-running operations, so it is common to connect them with the threads that execute these tasks to provide visual feedback to end users.
Getting ready
Our sample application will consist of a horizontal progress bar that will increment a fixed amount of progress once the user clicks on the Start
button:

How to do it...
To simulate the execution of a background task, the increment of the progress bar will be generated from a different thread that will suspend its execution for 1 second between each step.
The communication will be made using a synchronized queue that allow us to exchange information in a thread-safe manner:
import time import queue import threading import tkinter as tk import tkinter.ttk as ttk import tkinter.messagebox as mb class App(tk.Tk): def __init__(self...