Skip to content

Instantly share code, notes, and snippets.

@slarson
Created February 18, 2017 17:56
Show Gist options
  • Save slarson/21c6008202581b92c6d292b7ea45d682 to your computer and use it in GitHub Desktop.
Save slarson/21c6008202581b92c6d292b7ea45d682 to your computer and use it in GitHub Desktop.
from pyvirtualdisplay import Display
xephyr=Display(visible=1, size=(320, 240)).start()
from easyprocess import EasyProcess
from pyvirtualdisplay.smartdisplay import SmartDisplay
with SmartDisplay(visible=0, bgcolor='black') as disp:
with EasyProcess('gxmessage hello'):
img = disp.waitgrab()
img.save('screenshot.png')
//alternatively:
from easyprocess import EasyProcess
from pyvirtualdisplay.smartdisplay import SmartDisplay
with SmartDisplay(visible=0, bgcolor='black') as disp:
with EasyProcess('pynml examples/LEMS_c302_C2_MotorToMuscleSynTest.xml') as proc:
proc.sleep(10).stop()
img = disp.waitgrab(timeout=300)
img.save('screenshot.png')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment