Move ImageGrab docs back to ImageGrab.rst instead of autodoc

This commit is contained in:
Stephen Johnson 2013-10-13 09:56:33 -07:00
parent fdc48cba6f
commit 0f3f6dd1a3
2 changed files with 23 additions and 29 deletions

View File

@ -22,26 +22,12 @@ try:
# built-in driver (1.1.3 and later) # built-in driver (1.1.3 and later)
grabber = Image.core.grabscreen grabber = Image.core.grabscreen
except AttributeError: except AttributeError:
try: # stand-alone driver (pil plus)
# stand-alone driver (pil plus) import _grabscreen
import _grabscreen grabber = _grabscreen.grab
grabber = _grabscreen.grab
except ImportError:
# allow the module to be imported by autodoc
grabber = None
def grab(bbox=None): def grab(bbox=None):
"""
Take a snapshot of the screen. The pixels inside the bounding box are
returned as an "RGB" image. If the bounding box is omitted, the entire
screen is copied.
.. versionadded:: 1.1.3
:param bbox: What region to copy. Default is the entire screen.
:return: An image
"""
size, data = grabber() size, data = grabber()
im = Image.frombytes( im = Image.frombytes(
"RGB", size, data, "RGB", size, data,
@ -52,18 +38,8 @@ def grab(bbox=None):
im = im.crop(bbox) im = im.crop(bbox)
return im return im
##
def grabclipboard(): def grabclipboard():
"""
Take a snapshot of the clipboard image, if any.
.. versionadded:: 1.1.4
:return: An image, a list of filenames, or None if the clipboard does
not contain image data or filenames. Note that if a list is
returned, the filenames may not represent image files.
"""
debug = 0 # temporary interface debug = 0 # temporary interface
data = Image.core.grabclipboard(debug) data = Image.core.grabclipboard(debug)
if isinstance(data, bytes): if isinstance(data, bytes):

View File

@ -11,5 +11,23 @@ or the clipboard to a PIL image memory.
.. versionadded:: 1.1.3 .. versionadded:: 1.1.3
.. autofunction:: PIL.ImageGrab.grab .. py:function:: PIL.ImageGrab.grab(bbox=None)
.. autofunction:: PIL.ImageGrab.grabclipboard
Take a snapshot of the screen. The pixels inside the bounding box are
returned as an "RGB" image. If the bounding box is omitted, the entire
screen is copied.
.. versionadded:: 1.1.3
:param bbox: What region to copy. Default is the entire screen.
:return: An image
.. py:function:: PIL.ImageGrab.grabclipboard()
Take a snapshot of the clipboard image, if any.
.. versionadded:: 1.1.4
:return: An image, a list of filenames, or None if the clipboard does
not contain image data or filenames. Note that if a list is
returned, the filenames may not represent image files.