Am Mittwoch, den 01.11.2006, 10:14 +0000 schrieb Asrarahmed Kadri:
> 
>  
> Hi folks,
> How can I know that the user has pressed a particular key or c
> combination of keys.. for example 'q' or 'Ctrl-c' ....?

In practice that depends upon your environment. Unix/Linux, MacOS,
Windows, GUI vs. cmdline have all different ways to "read" from the
keyboard.

Ctrl-c OTOH, usually sends the interrupt signal to the process, and as
such can caught via the KeyboardInterrupt exception:

try:
    somework
except KeyboardInterrupt:
    ctrlc_caught

Andreas

>  
> Thanks in anticipation.
>  
> Regards,
>  
> Asrarahmed
>  
>  
> 
> -- 
> To HIM you shall return. 
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to