• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

PyVirtualDisplay.egg-info/H03-May-2022-202151

docs/H03-May-2022-15195

pyvirtualdisplay/H23-Jun-2019-639509

MANIFEST.inH A D25-May-2019177 1110

PKG-INFOH A D23-Jun-20196.9 KiB202151

README.rstH A D23-Jun-20194.7 KiB181131

pavement.pyH A D04-Mar-2016515 2519

setup.cfgH A D23-Jun-201938 53

setup.pyH A D23-Jun-20191.8 KiB6546

README.rst

1pyvirtualdisplay is a python wrapper for Xvfb_, Xephyr_ and Xvnc_
2
3Links:
4 * home: https://github.com/ponty/pyvirtualdisplay
5 * documentation: http://pyvirtualdisplay.readthedocs.org
6 * PYPI: https://pypi.python.org/pypi/pyvirtualdisplay
7
8|Travis| |Coveralls| |Latest Version| |Supported Python versions| |License| |Code Health| |Documentation|
9
10Features:
11 - python wrapper
12 - supported python versions: 2.7, 3.5, 3.6, 3.7
13 - back-ends: Xvfb_, Xephyr_, Xvnc_
14
15Known problems:
16 - only a few back-end options are supported
17
18Possible applications:
19 * GUI testing
20 * automatic GUI screenshot
21
22Basic usages
23============
24
25Start Xephyr::
26
27    from pyvirtualdisplay import Display
28    xephyr=Display(visible=1, size=(320, 240)).start()
29
30Create screenshot of xmessage with Xvfb::
31
32    from easyprocess import EasyProcess
33    from pyvirtualdisplay.smartdisplay import SmartDisplay
34    with SmartDisplay(visible=0, bgcolor='black') as disp:
35        with EasyProcess('xmessage hello'):
36            img = disp.waitgrab()
37    img.show()
38
39Installation
40============
41
42General
43-------
44
45 * install Xvfb_ or Xephyr_ or Xvnc_.
46 * install pip_
47 * optional: pyscreenshot_ and PIL_ should be installed for ``smartdisplay`` submodule
48 * install the program::
49
50    pip install pyvirtualdisplay
51
52Ubuntu 14.04
53------------
54::
55
56    sudo apt-get install python-pip
57    sudo apt-get install xvfb xserver-xephyr vnc4server
58    sudo pip install pyvirtualdisplay
59    # optional
60    sudo apt-get install python-pil scrot
61    sudo pip install pyscreenshot
62    # optional for examples
63    sudo pip install entrypoint2
64
65
66Uninstall
67---------
68
69::
70
71    pip uninstall pyvirtualdisplay
72
73
74Usage
75=====
76
77..  #-- from docs.screenshot import screenshot--#
78..  #-#
79
80GUI Test
81--------
82
83Testing ``gnumeric`` on low resolution::
84
85  #-- include('examples/lowres.py') --#
86  from easyprocess import EasyProcess
87  from pyvirtualdisplay import Display
88
89  if __name__ == "__main__":
90      # start Xephyr
91      Display(visible=1, size=(320, 240)).start()
92      # start Gnumeric
93      EasyProcess('gnumeric').start()
94  #-#
95
96Image:
97
98.. #-- screenshot('python -m pyvirtualdisplay.examples.lowres','lowres.png') --#
99.. image:: _img/lowres.png
100.. #-#
101
102Screenshot
103----------
104
105Create screenshot of ``xmessage`` in background::
106
107  #-- include('examples/screenshot3.py') --#
108  '''
109  using :keyword:`with` statement
110  '''
111  from easyprocess import EasyProcess
112  from pyvirtualdisplay.smartdisplay import SmartDisplay
113
114  if __name__ == "__main__":
115      with SmartDisplay(visible=0, bgcolor='black') as disp:
116          with EasyProcess('xmessage hello'):
117              img = disp.waitgrab()
118
119
120      img.show()
121  #-#
122
123
124Image:
125
126..  #-- screenshot('python -m pyvirtualdisplay.examples.screenshot3','screenshot3.png') --#
127.. image:: _img/screenshot3.png
128..  #-#
129
130vncserver
131---------
132
133::
134
135  #-- include('examples/vncserver.py') --#
136  '''
137  Example for Xvnc backend
138  '''
139
140  from easyprocess import EasyProcess
141  from pyvirtualdisplay.display import Display
142
143  if __name__ == "__main__":
144      with Display(backend='xvnc', rfbport=5904) as disp:
145          with EasyProcess('xmessage hello') as proc:
146              proc.wait()
147  #-#
148
149xauth
150=====
151
152Some programs require a functional Xauthority file. PyVirtualDisplay can
153generate one and set the appropriate environment variables if you pass
154``use_xauth=True`` to the ``Display`` constructor. Note however that this
155feature needs ``xauth`` installed, otherwise a
156``pyvirtualdisplay.xauth.NotFoundError`` is raised.
157
158
159.. _pip: http://pip.openplans.org/
160.. _Xvfb: http://en.wikipedia.org/wiki/Xvfb
161.. _Xephyr: http://en.wikipedia.org/wiki/Xephyr
162.. _pyscreenshot: https://github.com/ponty/pyscreenshot
163.. _PIL: http://www.pythonware.com/library/pil/
164.. _Xvnc: http://www.hep.phy.cam.ac.uk/vnc_docs/xvnc.html
165
166
167.. |Travis| image:: http://img.shields.io/travis/ponty/PyVirtualDisplay.svg
168   :target: https://travis-ci.org/ponty/PyVirtualDisplay/
169.. |Coveralls| image:: http://img.shields.io/coveralls/ponty/PyVirtualDisplay/master.svg
170   :target: https://coveralls.io/r/ponty/PyVirtualDisplay/
171.. |Latest Version| image:: https://img.shields.io/pypi/v/PyVirtualDisplay.svg
172   :target: https://pypi.python.org/pypi/PyVirtualDisplay/
173.. |Supported Python versions| image:: https://img.shields.io/pypi/pyversions/PyVirtualDisplay.svg
174   :target: https://pypi.python.org/pypi/PyVirtualDisplay/
175.. |License| image:: https://img.shields.io/pypi/l/PyVirtualDisplay.svg
176   :target: https://pypi.python.org/pypi/PyVirtualDisplay/
177.. |Code Health| image:: https://landscape.io/github/ponty/PyVirtualDisplay/master/landscape.svg?style=flat
178   :target: https://landscape.io/github/ponty/PyVirtualDisplay/master
179.. |Documentation| image:: https://readthedocs.org/projects/pyvirtualdisplay/badge/?version=latest
180   :target: http://pyvirtualdisplay.readthedocs.org
181