I have two buttons on form and when I press on button it stays in pressed condition , and frame stays unresponsive condition until operation of button1 is finished , in my case I call new xterm windows that stays opened and with button2 I want to open new xterm but until I close xterm window from button1 command entire GUI is unresponsive.
Why is that?
Thanks , I started using TKinter 2 days ago so go easy on me 🙂
I have two buttons on form and when I press on button it stays
Share
Tkinter works in a single thread. So when you press the button, the callback command is apparently not returning for a long time. This causes the Tkinter GUI to freeze until the callback command returns.
If possible, the solution is to break the callback command into smaller pieces, perhaps a loop, and call update_idletasks() frequently enough to allow the Tkinter GUI to update.
If that is not possible, then the callback command should spawn a thread so its execution will not block the Tkinter main event loop.