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

David Sumbler david at aeolia.co.uk
Wed Jun 10 09:26:28 UTC 2015

Sorry it has taken me until now to get back to the list.  This is the
first opportunity I have had since last week to look at the problem of
how to detect mouse-clicks.  Thanks to Akkana and others for the various
suggestions.  The simplest looks like the PyGame example noted by Miriam
(see below).

Thanks again to all.


On Thu, 2015-06-04 at 11:54 +1000, Miriam English wrote:
> Hi David,
> I was just perusing the examples directory in the standard pygame 
> installation and noticed that "eventlist.py" and "fastevents.py" might 
> be very close to what you want.
> There is another one called "chimp.py" which is a tiny, silly game 
> demonstrating a number of pygame's capabilities, including getting mouse 
> and keyboard events. The good thing about it is that there is a detailed 
> analysis of it at:
> http://www.pygame.org/docs/tut/chimp/ChimpLineByLine.html
> The part that handles events is near the end of the article. The 
> important part of the code is only 6 lines long.
> Cheers,
> 	- Miriam

More information about the Techtalk mailing list