Keys To The Kingdom

Rainy sill at optonline.net
Sun Jul 8 21:35:28 EDT 2001


On 09 Jul 2001 00:14:11 GMT, Tim Daneliuk <tundra at tundraware.com> wrote:
> I have a two part question about accepting keyboard input in python:
> 
> Is there a standard way to read one keystroke at a time rather than
> doing line input via raw_input()?

There is an entry in python FAQ about this (not msvcrt). 

> 
> For some reason, I cannot seem to catch Ctrl-C when it is typed in response
> to a raw_input() call.  This code still blows out of the python interpreter
> when the user keys in Ctrl-C:
> 
> try:
> 	x=raw_input()
> except KeyBoardInterrupt:
> 	# Handle the Ctrl-C and regroup
>         ...
> 
> ------------------------------------------------------------------------------
> Tim Daneliuk
> tundra at tundraware.com


-- 
Cymbaline: intelligent learning mp3 player - python, linux, console.
get it at: http://silmarill.org/cymbaline



More information about the Python-list mailing list