import time
from ctypes import Structure, windll, c_uint, sizeof, byref

class LASTINPUTINFO(Structure):
    _fields_ = [
        ('cbSize', c_uint),
        ('dwTime', c_uint),
    ]

def get_idle_duration():
    lastInputInfo = LASTINPUTINFO()
    lastInputInfo.cbSize = sizeof(lastInputInfo)
    windll.user32.GetLastInputInfo(byref(lastInputInfo))
    millis = windll.kernel32.GetTickCount() - lastInputInfo.dwTime
    return round(millis / 1000.0)
loopTimer = 1
while (loopTimer < 10):
    time.sleep(1)
    loopTimer = loopTimer + 1
    print(loopTimer)
    if (get_idle_duration() == 5):
        
