John Doe <jdoe@usenetlove.invalid> wrote: > >Tim Roberts <timr probo.com> wrote: > >> 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?
I see that this conversation took a nasty turn while I was on vacation. msvcrt.getch works with consoles. If you have an application where stdin and stdout are connected to a real, live console window (which looks just like a command line window), then msvcrt.getch will work. If not, then you have to use the Windows APIs. GetKeyboardState and GetKeyState can tell you if a specific key is currently being pressed. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list