Screenshots in Sphinx docs
Terry Reedy
tjreedy at udel.edu
Mon Dec 14 14:01:03 EST 2015
On 12/14/2015 11:31 AM, Albert-Jan Roskam wrote:
> I'd like to include up-to-date screenshots (of a tkinter app)
> into my Sphinx documentation.
If you manually take screenshots with *any* screen grabber and save in
an appropriate format, this is apparently trivial -- use the ..image
directive. From the below, it appears that what you want is to have a
literally up-to-date screenshot taken automatically during the doc build.
This requires that one be able to automate getting the application into
the exact display state one wants to capture. You can probably do that
with a tkinter app if you write it with that possibility in mind. In
particular, you must keep a Python reference to every widget you want to
manipulate, even if not needed for normal program operation.
There is also an issue with grabbing the whole screen versus only a
program-specific window.
> This looks ok:
> https://pypi.python.org/pypi/sphinxcontrib-programscreenshot
This (automatically) takes 'screenshots' on a no-screen (headless) *nix
system (during doc build) by redirecting X-windows output to a
pseudo-screen program. Rather clever, and system-specific.
> BUT I need something that works on Windows (Python 2.7).
> Can any recommend an approach? I thought about using PIL:
Get the pillow fork/upgrade on pypi.
> http://www.varesano.net/blog/fabio/capturing%20screen%20image%20python%20and%20pil%20windows
Or look into Windows screen grabber programs, of which there are many.
--
Terry Jan Reedy
More information about the Python-list
mailing list