Matplotlib animation either freezes after a few frames or just doesn't work

前端 未结 8 1334
悲哀的现实
悲哀的现实 2020-12-18 06:04

I\'ve been trying for hours to get this simple script working, but nothing I do seems to help. It\'s a slight modification of the most basic animated plot sample code from t

8条回答
  •  庸人自扰
    2020-12-18 06:52

    I was having (I think) the same trouble, where the window would freeze if I took the focus off it or tried to drag it around, using Python 2.7 on Windows 7 with Matplotlib 1.3, and TKAgg backend. I had a call to time.sleep(1) in my main while loop, and when I replaced that with plt.pause(1), that fixed the problem. So, try and use matplotlib's pause function rather than time module sleep function, it worked for me.

提交回复
热议问题