python - 使用 wxpython matplotlib 和 funcanimation 的 CPU/内存监视器

标签 python matplotlib wxpython

我使用 wxpython matplotlibfuncanimation 设计了 ​​cpu/memory 监视器。

问题描述:

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

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

enter image description here

在到达 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/

相关文章:

python - 一起使用模拟 (MyHDL) 和 wxPython

python - wxPython 或 pygame 用于简单的纸牌游戏?

python - 以可变间距读取python中的文本文件

python - 如何从 python 字典中返回特定信息?

python - 多个子图的自定义 xticks?

python - 如何并排绘制具有不同 X 坐标的条形图

python - 无法在 wxPython 中正确使用 wx.NotificationMessage

Python - 如何重新启动 for 循环?

Python Eval 使日期时间模块可用

python - MatPlotLib:同一个散点图上的多个数据集