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.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6db2638ef8ec65b164ce1724b18ff092aa79840410dc8b7b99028234d8793e3 |
|
MD5 | e64d3974da3238674471ed16c3f92834 |
|
BLAKE2b-256 | 68735a3841a5850fa5c7d5b9e613480645070b6e99cdb6ce6307441df4c7af06 |
Hashes for screen_brightness_control-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b1a05c66f5837640070b5efbd699925f76aae6cf58e6d871a3452a51bac5125e |
|
MD5 | 791bc5ebc45ab10f9f15ca245b039222 |
|
BLAKE2b-256 | 5a009db0d8498591548f0386ed7452199081490e38ece8b3ee1076fbafccb8a7 |