I would like to run a Python script that normally opens a Qt window remotely over a connection with no X11 forwarding. Is there any way to create some kind of virtual display that the window drawing can be sent to? (some x11-equivalent of /dev/null). The purpose of this is to check that a script works with the API of PyQt4 for different versions of PyQt4, but I want to be able to run this remotely on a server with no display. Any ideas?
You can install the xvfb utility
sudo apt-get install xvfb
and then start python scripts as:
xvfb-run python myscript.py
Or if you need to start the virtual display from code, xvfb is still needed to be installed, and additionally get the pyvirtualdisplay python package
pip install pyvirtualdisplay
And then before you create any qt component instances, add this:
from pyvirtualdisplay import Display
display = Display(visible=False, size=(1024, 768), color_depth=24)
display.start()