Using msvcrt (in Windows), how to catch Enter key?

Dick Moores rdm at rcblue.com
Mon Oct 29 11:26:49 CET 2007


Windows XP Pro, Python 2.5.1

import msvcrt
while True:
     if msvcrt.kbhit():
         key = msvcrt.getch()
         if key == 'Enter'
	 do something

Is there a way to catch the pressing of the 'Enter' key?

Thanks,

Dick Moores




More information about the Python-list mailing list