python实现windows倒计时锁屏功能

(编辑:jimmy 日期: 2024/11/13 浏览:2)

python实现windows倒计时锁屏功能

# 倒计时锁屏
import time
from ctypes import *
def closewindows(closetime):
  while closetime>0:
    print(closetime)
    time.sleep(1)
    closetime-=1
  user32 = windll.LoadLibrary('user32.dll')
  user32.LockWorkStation()
if __name__ == "__main__":
  closewindows(3)

知识点扩展:

Python在windows锁屏的代码

C:\Users\HAS>python
 Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:54:40) [MSC v.1900 64 bit (AMD64)]
 on win32
 Type "help", "copyright", "credits" or "license" for more information.
 > from ctypes import *
 > user32 = windll.LoadLibrary('user32.dll')
 > user32.LockWorkStation()

总结

以上所述是小编给大家介绍的python实现windows倒计时锁屏功能 ,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对网站的支持!
如果你觉得本文对你有帮助,欢迎转载,烦请注明出处,谢谢!