kbhit() and getch() question

Chris Gonnerman chris.gonnerman at usa.net
Thu Mar 8 21:46:44 EST 2001


----- Original Message -----
From: "Jeremy Reed" <jp_reed at yahoo.com>
Subject: kbhit() and getch() question

> In a previous question, I asked how to get non-blocking input from the
user.
> The answer proposed is as follows:
>
> import msvcrt
>
> ch = 0
> while ch != 'x':
>     if msvcrt.kbhit():
>         ch = msvcrt.getch()
>         print ch
>
> I have run into a few problems.  First of all, the kbhit() doesn't seem to
> work.  I am unable to find a way for the function to return true.
[brutal hack]

This code as given works for me on Win98SE, Python 2.0.  What is your
platform
and Python version?






More information about the Python-list mailing list