| 1 |
''' |
| 2 |
Screenshot |
| 3 |
========== |
| 4 |
|
| 5 |
The :class:`Screenshot` is used for capturing a digital image of what |
| 6 |
is currently visible on the monitor. |
| 7 |
|
| 8 |
The default path for taking screenshot is set in each platform implementation. |
| 9 |
|
| 10 |
Simple Examples |
| 11 |
--------------- |
| 12 |
|
| 13 |
To get the file path:: |
| 14 |
|
| 15 |
>>> screenshot.file_path |
| 16 |
'/sdcard/test.jpg' |
| 17 |
|
| 18 |
To set the file path:: |
| 19 |
|
| 20 |
>>> screenshot.file_path = '/Users/OSXUser/Pictures/screenshot.png' |
| 21 |
|
| 22 |
To take screenshot:: |
| 23 |
|
| 24 |
>>> from plyer import screenshot |
| 25 |
>>> screenshot.capture() |
| 26 |
''' |
| 27 |
|
| 28 |
|
| 29 |
class Screenshot: |
| 30 |
''' |
| 31 |
Screenshot facade. |
| 32 |
''' |
| 33 |
|
| 34 |
_file_path = '' |
| 35 |
|
| 36 |
def __init__(self, file_path=None): |
| 37 |
self._file_path = file_path |
| 38 |
|
| 39 |
def capture(self): |
| 40 |
self._capture() |
| 41 |
|
| 42 |
@property |
| 43 |
def file_path(self): |
| 44 |
return self._file_path |
| 45 |
|
| 46 |
@file_path.setter |
| 47 |
def file_path(self, location): |
| 48 |
''' |
| 49 |
Location of the screenshot. |
| 50 |
''' |
| 51 |
|
| 52 |
self._file_path = location |
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
def _capture(self, **kwargs): |
| 57 |
raise NotImplementedError() |