zanadu - 2011-08-19

How do you pause your program and wait for a keystroke like Escape. Most of the time, you will prompt for a keypress, so code with a prompt can be edited and used here.

In a console, it looks something like this…

<code>
def wait_for_keystroke():
  char=0
  while not (char==chr(27):
    char=msvcrt.getch()
</code>

But that won't work here, pyHook is required since I am operating in Windows.

So far, I have pyHook installed but have not written any code.

Any links to code or prior discussion will be appreciated.

Thanks.