how to exit from a pyplot loop?
matplotlib, python, tk-toolkit, tkinter
Solution
You are not in the `pyplot` loop per-say, but the main loop associated with the GUI toolkit (this is the loop that deals with all the user interactions with the GUI). I suspect it is safe to just call `exit()` in your program and let object clean up deal with properly tearing down the `TK` objects/mainloop
maybe related : Exit Tks mainloop in Python?,
Problem
I have a python program using pyplot (backend:tkagg), in which simply a matplotlib is created with some stuff in it. When I want to exit the program, I immediately call: ``` plt.close('all') ``` to shut it down. Strangely enough, the program dosnt exit. Following it with the debugger I saw that after everithing is done, it returns to ``` class Show(ShowBase): def mainloop(self): Tk.mainloop() ``` in backend_tkagg.py, followed by ``` if not is_interactive(): self.mainloop() ``` in the same file, then to ``` def show(*args, **kw): global _show _show(*args, **kw) ``` in pyplot.py So it appears that I am still in the pyplot loop! How do I exit from it correctly? thanks...