stopping a while True: with the keyboard

Andy fukazawa at gmail.com
Wed Sep 26 05:11:43 CEST 2007


Hi,

I think you can use the 'curses' module to catch the keyboard event.
The name of the method is 'keyname()'.  But I'm afraid curses is not
available on Windows Python, so you may have to be a bit more
imaginative.  I just tried with Python 2.4 on Windows XP.

To leave the while loop, use the 'break' command.

Andy




More information about the Python-list mailing list