I am  making some programs which includes while loops(to illustrate some number calculatings) and when I use Tkinter for GUI, the program windows is freezing until the loop finished. I want to add a stop button and I want the windows not to freeze. How can I do these two things?
Thank you
You'll have to use separate threads or processes.  Tkinter uses a single thread to process display updates, and the same thread is used to do event callbacks.  If your event handler blocks then no Tkinter code will execute until it completes.
If you have the Tkinter thread (the one that calls Tk.mainloop) and another thread for the rest of your application, then the event handlers running within the Tkinter thread can simply pass messages (possibly using Queue.Queue) to your application event handler.
Tkinter is freezing while the loop is processing, how can i prevent it?