Tkinter runs on a single thread. Therefore, when you press the button, the callback command does not seem to return for a long time. This will cause the Tkinter GUI to hang until the callback command returns.
If possible, the solution is to break the callback into smaller parts, possibly into a loop, and call update_idletasks () often enough to allow the Tkinter GUI to update.
If this is not possible, the callback command must create a thread so that its execution does not block the cycle of the main Tkinter event.
source share