[Tutor] Keyboard input

Joseph J. Strout joe@strout.net
Fri, 15 Oct 1999 13:55:12 -0700

At 8:47 PM +0000 10/15/99, neilconway@home.com wrote:

>1) I want to prompt for command-line input, and process that input - 
>similar to
>'scanf' in C.

foo = raw_input("bar:")

>2) I want to catch keyboard input while my program is running. How would I go
>about doing this? Do I have to wrap everything in a large try/except 

>While this program is running, if the user presses ^Z, then it, say,
>prints "Hello". How would I go about coding this?

You don't.  This is not possible in general.  On certain platforms, 
certain key combinations may be possible to check for or trap in 
certain ways.  But it's not a platform-independent thing, so if you 
must do it, specify your platform.

-- Joe

|    Joseph J. Strout           Biocomputing -- The Salk Institute |
|    joe@strout.net             http://www.strout.net              |