Processing a key pressed in Python 3.6

eryk sun eryksun at gmail.com
Wed Jan 24 17:07:54 EST 2018


On Wed, Jan 24, 2018 at 8:02 PM, Virgil Stokes <vs at it.uu.se> wrote:
> Yes, I am aware of this Dennis. However, but, on my system I actually had it
> running without the msvcrt.kbhit()

_getwch loops calling ReadConsoleInput until a key event is read. The
key can be typed manually in the console, or posted (i.e. PostMessage,
not SendMessage) to the console window as a WM_KEYDOWN message, or the
key event can be written directly to the input buffer via
WriteConsoleInput.

_kbhit calls PeekConsoleInput to scan for key events without removing
them from the input buffer. This call does not block.



More information about the Python-list mailing list