[Tutor] Catch event's on my computer

Alan Gauld alan.gauld at btinternet.com
Sat Jun 23 10:16:13 CEST 2007


"Flaper87" <flaper87 at gmail.com> wrote

> I mean, i need to catch every movement of the pointer, what its 
> position is
> everything. I've read that i can do that using my native system API, 
> and
> also pygame.

I don't know about pyGame but certainly the OS API should allow it.
What OS/GUI are you using? That will make a difference.

If its Windows then the ctypes module will give you access
to the Win32 API. You will need to refer to the Microsoft
documentation to figure out which API calls you need and
how to intercept them.

Its all pretty easy capturing them for your own app, but when
you try to track events outside your app it becomes pretty
low level and depends a lot on the individual OS, so we
can't really give general advice.

> My idea is to do this with a thread. What can you suggest me?

I'm not sure why a thread would help since its event driven.
You should just be able to catch the events as they come
in and update a data store of some kind. If anything I'd expect
the processing of the data store to be more likely running in
a thread.


-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld 




More information about the Tutor mailing list