shx2
shx2

Reputation: 64298

Exporting a plot in GUI-less pyqtgraph

I'm using the fabulous pyqtgraph in a script which creates a plot and exports it to a file (no interactive features are used). It works great.

However, when running it on a remote machine, with no X server, an error is raised in mkQApp():

cannot connect to X server

Is there a way to run pyqtgraph GUI-less-ly, removing the dependency on X?

I found there's a QtCore.QCoreApplication class, which, as to my understanding, is GUI-less. However, I'm not familiar enough with Qt to tell whether it can (or does) work with pyqtgraph.

Upvotes: 1

Views: 1063

Answers (1)

Luke
Luke

Reputation: 11644

It is not possible to use QGraphicsScene without a QApplication:

>>> from PyQt4 import QtGui, QtCore
>>> app = QtCore.QCoreApplication([])
>>> scene = QtGui.QGraphicsScene()
Segmentation fault

However, you should be able to use xvfb in the absence of any graphics hardware, and thus use your usual pyqtgraph script unchanged.

Upvotes: 0

Related Questions