Wait for a keypress before continuing?
Tim Roberts
timr at probo.com
Tue Aug 16 17:50:13 EDT 2011
John Doe <jdoe at 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?
>That means char=msvcrt.getch() is getting something?
Did you ever think about inserting a debug statement to help you?
print hex(ord(char))
--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the Python-list
mailing list