Introduction

Like any other programming language, Python lets you divide a process execution into multiple units that can be performed independently in time, called threads. When you launch a Python program, it starts its execution in the main thread.

Tkinter's main loop must start from the main thread, which is responsible for handling all the events and updates to the GUI. By default, our application code, such as callbacks and event handlers, will also be executed in this thread.

However, if we launch a long running action in this thread, the main thread execution will block until this operation is completed, and therefore the GUI will freeze and not respond to user events.

In this chapter, we will cover several recipes to achieve responsiveness in our applications while separate actions occur in the background, and also take a look at how to interact with them.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset