On this page
msvcrt.kbhit
Prev: msvcrt.getwch | Up: msvcrt | Next: msvcrt.locking
Rel: msvcrt.getch, msvcrt.getwch, msvcrt.locking
Ref: docs.python.org — msvcrt.kbhit
Tags: #public #python3 #stdlib #msvcrt
Import
import msvcrt
from msvcrt import kbhit
Signature & Overview
msvcrt.kbhit() -> bool
Return True if a keypress is waiting to be read.
Usage
import sys
# Windows-only: returns True if a keypress is waiting to be read
assert sys.platform != "win32" or True
Gotchas
- Windows-only: Non-blocking check before calling
getch()/getwch().
REPL Inspect
from msvcrt import kbhit
help(kbhit)
Linked from
Related notes
- tuts/python3/stdlib_module/msvcrt/getch Linked here; links to this page; shared tags: #msvcrt, #stdlib
- tuts/python3/stdlib_module/msvcrt/getwch Linked here; links to this page; shared tags: #msvcrt, #stdlib
- tuts/python3/stdlib_module/msvcrt/locking Linked here; links to this page; shared tags: #msvcrt, #stdlib
- tuts/python3/stdlib_module/msvcrt Linked here; links to this page; shared tags: #stdlib
- tuts/c/stdlib shared tags: #stdlib
- tuts/c/stdlib/assert shared tags: #stdlib
- tuts/c/stdlib/assert/assert shared tags: #stdlib
- tuts/c/stdlib/assert/static_assert shared tags: #stdlib
- tuts/c/stdlib/ctype shared tags: #stdlib
- tuts/c/stdlib/ctype/isalpha shared tags: #stdlib