[Techtalk] Detection of mouse-clicks and/or keypresses in Python

Miriam English mim at miriam-english.org
Wed Jun 3 23:10:52 UTC 2015

Hi David,

Detecting mouse and key events is easy in pygame. It is a bunch of 
modules that you simply import into python.

There are some easy-to-follow examples in the pygame installation, there 
are hundreds more examples on the site or linked to from it, and they 
have a very active and helpful email list.


You might find most useful:

With pygame you don't need to use delays. It will tell you when 
something happens.

Hope this helps,

	- Miriam

On 03/06/15 20:48, David Sumbler wrote:
> I want to write a simple program in Python 3, for my own use, which will
> detect mouse-clicks (or possibly key-presses from the keyboard) and
> record the exact time of each event.
> In principle this should be easy enough, except that I do not know how
> to detect the events themselves.
> The only information I need to collect is the time of the event: for
> this particular program I am not interested in recording which button or
> key is pressed.
> I have searched on the internet, but I can't seem to find what I want.
> What would be the simplest way to detect these events using Python?
> David
> _______________________________________________
> Techtalk mailing list
> Techtalk at linuxchix.org
> http://mailman.linuxchix.org/mailman/listinfo/techtalk

If you don't have any failures then you're not trying hard enough.
  - Dr. Charles Elachi, director of NASA's Jet Propulsion Laboratory
Website: http://miriam-english.org
Blogs:   http://miriam-e.dreamwidth.org

More information about the Techtalk mailing list