<p>I would like to know how long it's been since the user last hit a key or moved the mouse - not just in my application, but on the whole "computer" (i.e. display), in order to guess whether they're still at the computer and able to observe notifications that pop up on the screen.</p>

<p>I'd like to do this purely from (Py)GTK+, but I am amenable to calling platform-specific functions.  Ideally I'd like to call functions which have already been wrapped from Python, but if that's not possible, I'm not above a little bit of C or <code>ctypes</code> code, as long as I know what I'm actually looking for.</p>

<p>On Windows I think the function I want is <a href="http://msdn.microsoft.com/en-us/library/ms646302.aspx" rel="noreferrer"><code>GetLastInputInfo</code></a>, but that doesn't seem to be wrapped by pywin32; I hope I'm missing something.</p>

I got an answer regarding mouse-clicks suggesting to use
pyHook
:
Detecting Mouse clicks in windows using python
Here's some other code I did to detect mouse-position via ctypes:
http://monkut.webfactional.com/blog/archive/2008/10/2/python-win-mouse-position
A more round-about method to accomplish this would be via screen capture and comparing any change in images using PIL.
http://www.wellho.net/forum/Programming-in-Python-and-Ruby/Python-Imaging-Library-PIL.html