简单粗暴,三行代码搞定
from ctypes import * user32 = windll.LoadLibrary('user32.dll') user32.LockWorkStation()
上述代码同win+L 锁屏功能相同