A Python tool to control monitor brightness on Windows and Linux
Project description
screen_brightness_control
A Python tool for controlling the brightness of your monitor
How to install (Pip):
- Open a terminal and run "pip3 install screen-brightness-control"
How to install (Github):
- Clone/download the repository
- Enter the folder it has been cloned to and run "pip3 install ."
- That should be all
How to use:
import screen_brightness_control as sbc
current_brightness = sbc.get_brightnness()
if current_brightness<100:
sbc.set_brightness('+5')
The module has 2 basic functions: set_brightness and get_brightness.
get_brightness
Returns the current screen brightness in percent by default.
On Linux you can run get_brightness(raw_value=True) to get the 'actual value' which is usually stored in /sys/class/backlight/*/brightness.
set_brightness
Accepts either an integer or a string input. Any floats will be converted to integers.
You can also pass strings such as '+5' or '-15'. These are added/subtracted from the current brightness.
On Linux the brightness goes to a minimum of 1 unless you pass the 'force=True' kwarg. This is because setting the display brightness to 0 on Linux usually turns the screen off, which is not ideal.
You can also pass 'raw_value=True' as a kwarg to make the program attempt to write the number you supply directly to the /sys/class/backlight/*/brightness file. However, this will often not work as that file is above user permissions.
Both functions return False upon failure.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for screen_brightness_control-0.1.5.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b1f65b71b926537248ea05068cd1c94a0c09f8fb024f573459145f8ba1bca0c2 |
|
MD5 | 73aca7558d1c7287fc1ae9d9f32c6d6c |
|
BLAKE2b-256 | 8196cf8b6c965b5e3731b190ce31d7e1de16fa01d424f8d901862d4704bceae6 |
Hashes for screen_brightness_control-0.1.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f7a1a8de26ff253ca75267a5db3eda1b5527cf4d2b42ae8ac80fbe70b2add45 |
|
MD5 | a7e4bdcefb6fa00aedc99295ff563585 |
|
BLAKE2b-256 | 82e86fbc0dec26cef65cd6f3b60cffdc468337dafb534e94a06f22fa272ec46d |