-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
Description
If we try to export programatically from a widget that has just been created, the export fails because the widget has size 0. In this case, it would be better to catch the exception, call processEvents(), and then retry the export. Example:
import PySide
import pyqtgraph as pg
import numpy as np
data = np.random.normal(size=1000)
win = pg.GraphicsWindow(title="hi")
win.resize(800,800)
p1 = win.addPlot()
plt = p1.plot(data, title="Simplest possible plotting example")
# pg.QtGui.QApplication.processEvents() # <-- fixes the bug
exporter = pg.exporters.ImageExporter.ImageExporter(p1)
exporter.parameters()['width'] = 800
exporter.export("yay" + ".png")
Reactions are currently unavailable