Threads and Timers
Mike Driscoll · Apress eBooks · 2017
If you use GUIs (graphical user interfaces) in Python much, you know that every now and then you need to execute some long-running process. Of course, if you do that as you would with a command-line program, then you'll be in for a surprise. In most cases, you'll end up blocking your GUI's event loop and the user will see your program freeze. This is true of all the Python GUI toolkits, including Tkinter, PyQt, or wxPython. What can you do to get around such mishaps? Start the task in another thread or process, of course! In this chapter, we'll look at how to do this with wxPython and Python's threading module.