Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to use python to sleep if the user is not using the system

import mouse
import time
import os
import pyttsx3
while True:
    before_sleep = mouse.get_position()
    time.sleep(600)
    after_sleep = mouse.get_position()
    if before_sleep == after_sleep:
        pyttsx3.speak("Going to shut down")
        os.system("shutdown /s /t 1")
 
PREVIOUS NEXT
Tagged: #python #sleep #user #system
ADD COMMENT
Topic
Name
6+3 =