NewBie: How Can I Scan The Keyboard In Python?

Fredrik Lundh fredrik at effbot.org
Thu Jan 11 14:00:26 EST 2001


jbranthoover at my-deja.com wrote:
> Is there a way to scan the keyboard to watch for a key
> closure?

    http://www.python.org/doc/FAQ.html#8.2
    "8.2. How to check for a keypress without blocking?
    "Use the msvcrt module. This is a standard Windows-specific
    extensions in Python 1.5 and beyond. It defines a function
    kbhit() which checks whether a keyboard hit is present; also
    getch() which gets one character without echo. Plus a few
    other goodies."

for more info, see the library reference.

Cheers /F





More information about the Python-list mailing list