PyQt/PySide 简单的 XY 绘图小部件

PyQt/PySide simple XY Plot widget

我想为我公司开发的新硬件编写简单的 GUI 工具。我需要使用 python 因为我的公司使用了很多旧库。 我现在的想法是用Python和PyQt编写应用,用pyinstaller部署给其他同事(到处安装python不是我们想要的)。到目前为止它工作得很好,但是当我尝试使用绘图库时,例如 PyQwt,可执行文件的大小从大约 15MB 增加到 120MB。我发现这是因为 PyQwt 支持 NumPy。但是,我的项目不需要 NumPy。

我发现了一些绘图工具,例如:PyQwt、Matplotlib、PyQtGraph 然而,他们都使用 Numpy。

我的问题是:是否有不需要 Numpy 的 PyQt/PySide 绘图工具或框架?

我需要绘制的是简单的顺序数据。例如,传感器每秒提供一个温度,我想在 y/t 图表中查看最后 20 个温度。

最好是没有 numpy 的 PyQwt。 PyQwt 主页说 NumPy 是可选的。 最终是否有可能以跳过 numpy 的方式配置 PyInstaller?

非常感谢您的帮助!

我的系统: Windows 7 PythonXY 2.7.10 PyQT4

查看 documentation,向下 3.Fine 调整(可选):

to the configure.py options.

The configure.py script takes many options. The command:

python configure.py -h

displays a full list of the available options

然后查看这些选项,我可以看到如何禁用 Numpy:

Detection options:

--disable-numarray  disable detection and use of numarray [default
                    enabled]
--disable-numeric   disable detection and use of Numeric [default enabled]
--disable-numpy     disable detection and use of NumPy [default enabled]

因此,如果您在 PyQwt 目录下 运行 以下命令,您将能够禁用 Numpy:

$:python configure.h --disable-numarray

如果您的要求只是绘制简单的顺序数据,例如传感器读数与时间的关系,我建议您 PyQtGraph and an example of real time plotting

一个通用示例:

import pyqtgraph as pg
pw = pg.PlotWidget(name='My Graph')
horizontalLayout_Plot.addWidget(pw)
x,y = range(10),range(10)
pw.plot(x,y)