【问题标题】:Exporting Image of the widget in pyqtgraph在 pyqtgraph 中导出小部件的图像
【发布时间】:2016-12-11 22:26:33
【问题描述】:

我正在创建一个GraphicsLayoutWidget,然后使用addPlot() 将绘图添加到小部件。此小部件不显示在屏幕上,但用于通过以下方式导出图像:

    exporter = pyqtgraph.exporters.ImageExporter(pwidget.scene())
    exporter.export(os.path.join(datadirtemp, str(typename) + '.png'))

但图像永远不会覆盖整个情节。

此外,使用以下项目也无济于事:

exporter.parameters()['width'] = pwidget.scene().sceneRect().width()

我收到以下错误:

Cannot export image with size=0 (requested export size is 0x0)

【问题讨论】:

    标签: pyqt pyqtgraph


    【解决方案1】:

    您正在尝试在初始化之前导出窗口。所以你需要这样做

    QtGui.QApplication.processEvents()

    在导出之前。

    参考链接: from pyqtgraph's forum

    【讨论】:

      猜你喜欢
      • 2015-02-16
      • 2017-04-09
      • 2017-06-19
      • 2014-07-07
      • 2016-08-21
      • 2021-10-15
      • 2013-06-29
      • 2018-06-27
      • 2015-09-13
      相关资源
      最近更新 更多