0
0

TkInterでmatplotlib.pyplotを使用したときにプログラムが終了しない不具合

Posted at

プログラムが正常終了しない

以下のプログラムを実行したときに,表示されたウィンドウを閉じてもプログラムが終了しないという不具合が発生しました.

min.py
import tkinter
import matplotlib.pyplot as plt

root = tkinter.Tk()

plt.figure()
# ... グラフを表示するための処理

root.mainloop()

解決策

plt.close()を追加

solution.py
import tkinter
import matplotlib.pyplot as plt

root = tkinter.Tk()

plt.figure()
# ... グラフを表示するための処理
plt.close()

root.mainloop()
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0