Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to set screen brightness automatically depending on battery percentage using python

import psutil
import screen_brightness_control as screen
while True:
    battery =  psutil.sensors_battery()
    if battery.power_plugged == True:
        screen.set_brightness(50)
    elif battery.percent >= 30 and battery.power_plugged == False:
        screen.set_brightness(0)
 
PREVIOUS NEXT
Tagged: #set #screen #brightness #automatically #depending #battery #percentage #python
ADD COMMENT
Topic
Name
7+6 =