📜  如何使用python代码示例根据电池百分比自动设置屏幕亮度

📅  最后修改于: 2022-03-11 14:46:39.476000             🧑  作者: Mango

代码示例1
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)