| 1 |
''' |
| 2 |
Brightness |
| 3 |
========== |
| 4 |
|
| 5 |
This API helps you to control the brightness of your primary display screen. |
| 6 |
|
| 7 |
The :class:`Brightness` provides access to public methods to control the |
| 8 |
brightness of screen. |
| 9 |
|
| 10 |
NOTE:: For Android, make sure to add permission, WRITE_SETTINGS |
| 11 |
|
| 12 |
Simple Examples |
| 13 |
--------------- |
| 14 |
To know the current brightness level of device:: |
| 15 |
|
| 16 |
>>> from plyer import brightness |
| 17 |
>>> brightness.current_level() |
| 18 |
|
| 19 |
To set the brightness level to half of maximum:: |
| 20 |
|
| 21 |
>>> from plyer import brightness |
| 22 |
>>> brightness.set_level(50) |
| 23 |
|
| 24 |
Supported Platforms |
| 25 |
------------------- |
| 26 |
Android, iOS, Linux |
| 27 |
''' |
| 28 |
|
| 29 |
|
| 30 |
class Brightness: |
| 31 |
''' |
| 32 |
Brightness facade. |
| 33 |
''' |
| 34 |
|
| 35 |
def current_level(self): |
| 36 |
''' |
| 37 |
Know the current level of device's brightness. |
| 38 |
''' |
| 39 |
return self._current_level() |
| 40 |
|
| 41 |
def set_level(self, level): |
| 42 |
''' |
| 43 |
Adjust the brightness of the screen. |
| 44 |
Minimum brightness level:: 1 |
| 45 |
Maximum brightness level:: 100 |
| 46 |
|
| 47 |
:param level: New level of brightness between 1 and 100 |
| 48 |
:type level: int |
| 49 |
''' |
| 50 |
return self._set_level(level) |
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
def _set_level(self, level): |
| 55 |
raise NotImplementedError() |
| 56 |
|
| 57 |
def _current_level(self): |
| 58 |
raise NotImplementedError() |