[Tutor] Help: how to detect which key is pressed

Luke Paireepinart rabidpoobear at gmail.com
Sat Oct 7 04:39:26 CEST 2006


Asrarahmed Kadri wrote:
>  
>  
> I am writing a simple program and in that I want to add some sort of 
> interactiveness.
> I have designed a menu which gives the user an option to select one 
> out of the following four keys: d, l, n or e.
> Can any one tell me how to determine which key has been pressed by the 
> user.
Asrarahmed:
Please refer to:
http://www.freenetpages.co.uk/hp/alan.gauld/
for information on how to do this.
specifically,
http://www.freenetpages.co.uk/hp/alan.gauld/tutinput.htm

You should work through this tutorial, not just the specific section on 
User Input, but the whole site.
It will cover the most common questions that people new to Python have.

Good Luck,
-Luke


More information about the Tutor mailing list