pyvirtualdisplay is a python wrapper for Xvfb, Xephyr and Xvnc
- Links:
- Features:
- Known problems:
only a few back-end options are supported
- Possible applications:
GUI testing
automatic GUI screenshot
Basic usages
Start Xephyr:
from pyvirtualdisplay import Display xephyr=Display(visible=1, size=(320, 240)).start()
Create screenshot of xmessage with Xvfb:
from easyprocess import EasyProcess
from pyvirtualdisplay.smartdisplay import SmartDisplay
with SmartDisplay(visible=0, bgcolor='black') as disp:
with EasyProcess('xmessage hello'):
img = disp.waitgrab()
img.show()
Installation
General
Ubuntu 14.04
sudo apt-get install python-pip sudo apt-get install xvfb xserver-xephyr vnc4server sudo pip install pyvirtualdisplay # optional sudo apt-get install python-pil scrot sudo pip install pyscreenshot # optional for examples sudo pip install entrypoint2
Uninstall
pip uninstall pyvirtualdisplay
Usage
GUI Test
Testing gnumeric on low resolution:
#-- include('examples/lowres.py') --#
from easyprocess import EasyProcess
from pyvirtualdisplay import Display
if __name__ == "__main__":
# start Xephyr
Display(visible=1, size=(320, 240)).start()
# start Gnumeric
EasyProcess('gnumeric').start()
#-#
Image:
Screenshot
Create screenshot of xmessage in background:
#-- include('examples/screenshot3.py') --#
'''
using :keyword:`with` statement
'''
from easyprocess import EasyProcess
from pyvirtualdisplay.smartdisplay import SmartDisplay
if __name__ == "__main__":
with SmartDisplay(visible=0, bgcolor='black') as disp:
with EasyProcess('xmessage hello'):
img = disp.waitgrab()
img.show()
#-#
Image:
vncserver
#-- include('examples/vncserver.py') --#
'''
Example for Xvnc backend
'''
from easyprocess import EasyProcess
from pyvirtualdisplay.display import Display
if __name__ == "__main__":
with Display(backend='xvnc', rfbport=5904) as disp:
with EasyProcess('xmessage hello') as proc:
proc.wait()
#-#
xauth
Some programs require a functional Xauthority file. PyVirtualDisplay can generate one and set the appropriate environment variables if you pass use_xauth=True to the Display constructor. Note however that this feature needs xauth installed, otherwise a pyvirtualdisplay.xauth.NotFoundError is raised.
Release files for PyVirtualDisplay 0.2.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| PyVirtualDisplay-0.2.4.tar.gz | 32.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| PyVirtualDisplay-0.2.4-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size:47.7 kB
Release files / PyVirtualDisplay-0.2.4.tar.gz
| Download URL | PyVirtualDisplay-0.2.4.tar.gz |
|---|---|
| Size | 32.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
07f50759205adaeeb255a88be0ac1dce68da80686e6ca1fc362f4aa54fdbcb5b
|
|
BLAKE2b-256 checksum How to use checksums |
3f70d0672122363f70b8fd29aeabd0b90a947b08c104e9b6cefd2ae6719ec2bc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/2.7.16
|
Release files / PyVirtualDisplay-0.2.4-py2.py3-none-any.whl
| Download URL | PyVirtualDisplay-0.2.4-py2.py3-none-any.whl |
|---|---|
| Size | 15.3 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
877f9ac9b8344d4bb8f6f4ec0db78db5dabb8f1240b692989e40a330d6fadd6e
|
|
BLAKE2b-256 checksum How to use checksums |
cfadb15f252bfb0f1693ad3150b55a44a674f3cba711cacdbb9ae2f03f143d19
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/2.7.16
|