Export errors

65 views
Skip to first unread message

jona.j...@gmail.com

unread,
Mar 8, 2019, 4:41:18 AM3/8/19
to pyqtgraph
Hi,
I've been developing a GUI app to display and analyze time series using pyqtgraph.
One of the problems I am currently facing is that I cannot export the figures using the default pyqtgraph context menu.

When I do an SVG export I see the following errors in the console:
QPainter::deviceTransform: Painter not active
QPainter::deviceTransform: Painter not active
QPainter::deviceTransform: Painter not active
QPainter::deviceTransform: Painter not active

When I do a PNG export I see the following errors:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pyqtgraph/exporters/Exporter.py", line 77, in fileSaveFinished
    self.export(fileName=fileName, **self.fileDialog.opts)
  File "/usr/lib/python3/dist-packages/pyqtgraph/exporters/ImageExporter.py", line 70, in export
    bg = np.empty((self.params['width'], self.params['height'], 4), dtype=np.ubyte)
TypeError: 'float' object cannot be interpreted as an integer

When I export SVG, despite the errors, an SVG file is created. However it only features the legend.

In my code I subclass PlotWidget, PlotDataItem and ScatterPlotItem. The PlotDataItem and ScatterPlotItem are attached to PlotWidget. I don't think I reimplement any methods of the base class, I only add features to the classes. I think Qt related things are not correctly initialized, hence the "Painter not active" message. I cannot explain the PNG exception however.

I use pyqtgraph 0.10.0, pyqt 5.11.3 and python 3.7.2+

The code repository is hosted here: https://github.com/jaj42/GraPhysio
The relevant code is in plotwidget.py, tsplot.py and curves.py under graphysio/plotwidgets.

Here are two screenshots showing the running app and the exported SVG:

Screenshot_2019-03-08_10-22-09.pngScreenshot_2019-03-08_10-20-07.png



Any help would be greatly appreciated.

Kind regards,
Jona Joachim

Patrick

unread,
Mar 8, 2019, 8:55:20 PM3/8/19
to pyqtgraph
Hi,

I think that's a bug in version 0.10 of pyqtgraph. Try a version pulled from git, or on version 0.10 in those lines from the error message you can insert a cast to int on the height and width.

Patrick

Reply all
Reply to author
Forward
0 new messages