How it works...
In the callProgressBarTwoThreadsLocks.pyw file, there are two classes: one is the main class, called the MyForm class, which basically interacts with the GUI form, and the second class is the myThread class, which creates and invokes two threads, which in turn update the two Progress Bar widgets used in the GUI.
To use threads in Python, the first step is to import Thread. The import threading statement imports Thread in the current script. After importing Thread, the second step is to subclass our class from the Thread class. Hence, our class called myThread inherits the Thread class.
In the main section of the script, an object of the main class, MyForm, is made, called w. Thereafter, two threads are created by name, thread1 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access