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)
grabber = Image.core.grabscreen
except AttributeError:
try:
# stand-alone driver (pil plus)
import _grabscreen
grabber = _grabscreen.grab
except ImportError:
# allow the module to be imported by autodoc
grabber = 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()
im = Image.frombytes(
"RGB", size, data,
@ -52,18 +38,8 @@ def grab(bbox=None):
im = im.crop(bbox)
return im
##
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
data = Image.core.grabclipboard(debug)
if isinstance(data, bytes):

View File

@ -11,5 +11,23 @@ or the clipboard to a PIL image memory.
.. versionadded:: 1.1.3
.. autofunction:: PIL.ImageGrab.grab
.. autofunction:: PIL.ImageGrab.grabclipboard
.. py:function:: PIL.ImageGrab.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
.. 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.