Tim Roberts <timr probo.com> wrote: > John Doe <jdoe@usenetlove.invalid> wrote: > >>def wait_for_keystroke(): >> char=0 while not (char==chr(27) or char==chr(110)): >> char=msvcrt.getch() if char==0: >> return >> >>That freezes the process. > > That exact code works perfectly for me. The function returns as > soon as I press the escape key. You are running this from a > console process, and not a GUI process, right?
No. I am running this from within Windows, all sorts of Windows. So... Does that mean I will need something complex like a keyboard hook? Or what? Thanks. -- > >>That means char=msvcrt.getch() is getting something? > > Did you ever think about inserting a debug statement to help you? > print hex(ord(char)) -- http://mail.python.org/mailman/listinfo/python-list