Python Matplotlib runtime error upon closing the console Python Matplotlib runtime error upon closing the console tkinter tkinter

Python Matplotlib runtime error upon closing the console


You have multiple gui event loops running (the one from you TK, and the one plt starts). Do not import plt or mlab. See http://matplotlib.org/examples/user_interfaces/embedding_in_tk.html for how to properly embed in Tk.

You basically need to change this line

fig=plt.figure()

to

fig = Figure()

and get rid of plt in your imports.