Read one key press.

Gerrit Holl gerrit.holl at pobox.com
Mon Oct 18 11:51:23 EDT 1999


Hi,

if I have the following program:

key = raw_input("press a key: ")
if key == 'a':
    print "you pressed 'a'"
elif key == '^['
    print "you pressed escape"

it doesn't work. Well, it works but it itsn't what I'm looking for. I want
ONE key input. Can this me done easyly?

If not, I think there should come a function or a module readkey() with some
constants like ESCAPE, CONTROL, NUMLOCK, ARROW_UP or TAB.

regards,
Gerrit.
-- 
linuxgames.nl.linux.org	 All about games on Linux in Dutch (under construction).
www.nl.linux.org	       The Dutch resource for Dutch Linux documentation.
www.nl.linux.org/discoverb		    Learn foreign words and definitions.
www.nl.linux.org/~gerrit/asperger	 I'm an Asperger, go here for more info.
www.nl.linux.org/~gerrit			    About me and pictures of me.




More information about the Python-list mailing list