Add the following part under the script that displays the figure with matplotlib.
tkinter.py
def _destroyWindow():
root.quit()
root.destroy()
root = tk.Tk()
root.withdraw()
root.title("title")
root.geometry("770x500")
root.protocol('WM_DELETE_WINDOW', _destroyWindow) # When you close the tkinter window.
# Canvas
canvas = FigureCanvasTkAgg(fig, master=root) # Generate canvas instance, Embedding fig in root
canvas.draw()
canvas.get_tk_widget().pack()
#canvas._tkcanvas.pack()
# root
root.update()
root.deiconify()
root.mainloop()
If the figure of the blue feather mark is displayed with this, it is ok
Recommended Posts