loop until keypress (Windows XP)

placid Bulkan at gmail.com
Thu Aug 10 19:06:07 EDT 2006


Thomas Guettler wrote:
> Am Wed, 09 Aug 2006 22:19:24 -0700 schrieb placid:
>
> > Hi all,
> >
> >
> > Im using the cmd module and i have command that loops and keeps on
> > printing text, what i want to be able to do is loop until the user
> > presses a particular key, say Q/q ? I tried the following code;
> >
>
> There is a portable getch() implementation:
>
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/134892
>
> It does not loop, it waits until the key is pressed. I hope that is what
> you want.


i want a read operation that doesn't block and im not concerned if my
program is Windows only, which is. (im using wmi module too).

msvcrt.kbhit() and msvcrt.getch() is what i need!


Cheers




More information about the Python-list mailing list