© Mike Driscoll 2018
Mike DriscollwxPython Recipeshttps://doi.org/10.1007/978-1-4842-3237-8_16

16. Threads and Timers

Mike Driscoll
(1)
Ankeny, New York, USA
 

Recipe 16-1. How to Update a Progress Bar from a Thread

Problem

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 ...

Get wxPython Recipes: A Problem - Solution Approach now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.