How do I detect if the system is idle on Windows using Python (i.e. no keyboard or mouse activity).
This has already been asked before, but there doesn\'t seem to be a
Actually, you can access GetLastInputInfo via the cytpes library:
import ctypes
GetLastInputInfo = ctypes.windll.User32.GetLastInputInfo # callable function pointer
This might not be what you want though, as it does not provide idle information across the whole system, but only about the session that called the function. See MSDN docs.
Alternatively, you could check if the system is locked, or if the screen-saver has been started.