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

Miriam English mim at miriam-english.org
Thu Jun 4 01:54:24 UTC 2015


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


-- 
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
          http://miriam-e.livejournal.com




More information about the Techtalk mailing list