我使用 wxpython matplotlib
和 funcanimation
设计了 cpu/memory
监视器。
问题描述:
self.line_animation = animation.FuncAnimation(self.figure, self.update_lines, frames = 25, interval = 1000, blit = False)
这就是我开始动画的方式。
在到达 frame 25
之前一切正常,在那之后至少从绘制的图表中我看到了一种重置行为。
这发生在每 25 帧的周期
之后。
def update_lines(self, num):
self.get_system_info()
for counter, value in self.data.iteritems():
self.graph_lines[counter].set_data(self.times, value[1])
self.cpu_axes.relim() # Recalculate limits
self.cpu_axes.autoscale_view(True, True, True)
self.cpu_axes.legend()
self.mem_axes.relim() # Recalculate limits
self.mem_axes.autoscale_view(True, True, True)
self.system_canvas.draw()
问题:可能是什么问题?
最佳答案
这篇文章是为了完成这个话题。我按照@furas 的建议使用 wx.Timer 解决了我的问题。
我花了一整天的时间研究 FuncAnnimation 中的问题的解决方法,但没有成功!
关于python - 使用 wxpython matplotlib 和 funcanimation 的 CPU/内存监视器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40669674/