【问题标题】:CPU/memory monitor using wxpython matplotlib and funcanimation使用 wxpython matplotlib 和 funcanimation 的 CPU/内存监视器
【发布时间】:2016-11-18 04:58:49
【问题描述】:

我使用wxpython matplotlib 和funcanimation 设计了cpu/memory 监视器。

问题描述:

self.line_animation = animation.FuncAnimation(self.figure, self.update_lines, frames = 25, interval = 1000, blit = False)

这就是我开始动画的方式。

在我到达frame 25 之前一切正常,之后至少从绘制的图表中我看到了一种重置的行为。 每次cycle of 25 frames 之后都会发生这种情况。

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()

问题:可能是什么问题?

【问题讨论】:

  • 大家好,我是stackoverflow的新手,不知道如何附加图片......
  • 可能作为初学者,您可以附加图像-您可能需要更多积分。在imgur.com上添加图片的普通链接
  • 正常 - 动画(默认)循环运行。 FuncAnimation 有一些选项可以只播放一次动画。您设置了frames=25,因此动画只创建 25 帧并从头开始
  • @furas 这里是图片链接,imgur.com/a/YYvSY 不能有流畅的动画吗?
  • 也许使用wx.Timer 而不是FuncAnimation

标签: python matplotlib wxpython


【解决方案1】:

这篇文章是为了完成线程。我按照@furas 的建议使用 wx.Timer 解决了我的问题。

我花了一整天时间研究 FuncAnimation 中我的问题的解决方法,但没有运气!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-08-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-02-02
    • 2018-11-08
    • 2011-01-10
    • 2020-09-30
    相关资源
    最近更新 更多