Using threads
When writing a Python application, all of the code will run in a single thread by default. This means that, as you read down a file, each line will be carried out one at a time. A piece of code cannot run if there is another piece above it which is executing a large task.
If we wanted to carry out multiple tasks at the same time, there are a couple of different ways we could go about doing so. One way is the use of a thread. When using a thread, the operating system will be able to quickly switch between two running pieces of code so quickly that it appears as if they are being executed at the same time. This means that if you have a function which takes a lot of processing, you are able to do multiple smaller tasks in the time it would take for that function to execute, thereby speeding up the overall process.
Why use a thread with a GUI application?
Graphical applications tend to execute everything in the main thread. This means that updates to its widgets happen in line with...