matplotlib / pyplot / 一定時間ごとに何かをする FuncAnimation()
from matplotlib import pyplot as plt from matplotlib import animation def frameNum(i): # i はフレーム番号 print(i) fig = plt.gcf() # FuncAnimation オブジェクトは、何かの変数に代入しておかないとガーベジコレクションされてしまう。 sute = animation.FuncAnimation(fig , frameNum , # この函数が interval ごとに呼ばれる。 interval = 1000 , ) plt.show()