Typically tkinter is used with its own main loop that takes over the main thread. You need to run your app code off its callbacks or in a different thread. But you can also call tkinter to update from your own main loop without it taking over the thread. ap_gui.py