Skip to content
Advertisement

How to properly close tkinter Toplevel with matplotlib embeded?

I’m making a GUI application and I want to use matplotlib to display some plots. I have structured my code like that:

JavaScript

The problem I have is that when the toplevel window is displayed and then closed, the program won’t close correctly even after closing the root window.

Is there a way to fix this??

Advertisement

Answer

As Henry Yik pointed out matplotlib.figure.Figure should be used instead of pyplot. Now it works:

JavaScript
Advertisement