I have a wxPython program, and it has a loop. I want to be able to break the loop by pushing a button. But it doesn't react to events until the loop finishes, which is sort of pointless. What's the best way to get it to work? Do I need threads? Or is there a more convenient way?