mpylab.tools.keyboard module

This is mpylab.tools.keyboard.

Provides getch, kbhit and getwch for POSIX

author:

Hans Georg Krauthäuser (main author)

license:

GPL-3 or higher

exception mpylab.tools.keyboard.KeyboardUnavailableError

Bases: RuntimeError

Raised when stdin cannot be used for terminal-style keyboard input.

mpylab.tools.keyboard.LookForUserInterrupt()

Poll keyboard and return True when user requests abort.

class mpylab.tools.keyboard.PosixTerm

Bases: object

PosixTerm class.

getch(fd=None)

getch method.

getwch(fd=None, encoding=None)

getwch method.

kbhit(fd=None)

kbhit method.

mpylab.tools.keyboard.anykeyevent() int | None

Detect a key or function key press and return its ASCII code or scancode.

mpylab.tools.keyboard.funkeypress()

Wait for any key and return ASCII code or cooked function-key scancode.

mpylab.tools.keyboard.getch(fd=None)

getch method.

mpylab.tools.keyboard.kbhit(fd=None)

kbhit method.

mpylab.tools.keyboard.keypress()

Wait until a key is pressed and return its ASCII code.

Function keys return 0 and their second scan-code byte is discarded.