Python and USB

Gabriel Genellina gagsl-py2 at
Wed Oct 14 17:11:01 CEST 2009

En Wed, 14 Oct 2009 09:55:15 -0300, Ronn Ross <ronn.ross at>  

> I'm new to Python and would like to capture mouse movements. I envision
> writing a script that will just write out the mouse movements in the  
> term.
> Is this possible? Can someone point me in the right direction?

Capture mouse movements in your application, or globally?
All GUI frameworks that I know of (including the one that comes with  
Python, Tkinter, a wrapper around Tk and Tcl) provide some sort of  
notifications when the mouse is over your program window.
If you need to track the mouse everywhere (not only inside your app), that  
depends on the OS and desktop you're using. On Windows I think there's a  
library named pyhook or similar.

Gabriel Genellina

More information about the Python-list mailing list