使用 Python3.X 在 Windows 10 上控制屏幕亮度
问题描述:
我想用 Python 写一个脚本(这里是 3.5)来控制我的笔记本电脑屏幕的亮度(有一台 HP EliteBook,不知道它是否重要).有谁知道是否有一些代码/模块?
I want to write a script in Python (3.5 here) to control the brightness of the screen on my laptop (got a HP EliteBook, don't know if it's important). Does anyone know if there's some code/module for this ?
提前谢谢大家,祝你有美好的一天!
Thanks in advance everyone, have a good day !
答
终于找到了一种在 Windows 10 中与屏幕交互的方法.感谢 martineau,PyWin32 是解决方案的一部分.WMI 包是另一部分.
Finally found a way to interact with the screen in Windows 10. Thanks martineau, PyWin32 was a part of the solution. WMI package was the other part.
wmi.WMI(namespace='wmi').WmiMonitorBrightnessMethods()[0].WmiSetBrightness(brightness, 0)
其中亮度是 0 到 100 之间的整数.
where brightness is an int between 0 and 100.