stopping a while True: with the keyboard

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


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.


More information about the Python-list mailing list