Check for keystroke

Josef Meile jmeile at
Wed Sep 22 20:08:27 CEST 2004

Hi Brian,

I saw an example on pyserial called "". It was about doing a 
text based chat between two computers connected with through the serial 
port. It is made with threads, so you can do something else while it 
waits for characters from the keyboard. When a key is pressed, then it 
is echoed to the console. I think you can easilly remove the serial 
stuff and do the check you need. Here is the link:


Brian wrote:
> Inside a loop, I need to passively check to see if a key is pressed or not 
> without pausing like raw_input does.  Some pseudocode:
> While true:
>     	If a key is pressed
>     	    	which key is pressed
>     	do other stuff inside loop
> Google groups turned up this thread:
> 3221aa1ee6ef2ec2&seekm=2259b0e2.0307310800.3310ec83%
> TinyURL:
> But neither the pygame or curses solution worked.  Any new thoughts on 
> this?

More information about the Python-list mailing list