lib.keypress Module

Source: http://home.wlu.edu/~levys/software/kbhit.py A Python class implementing KBHIT, the standard keyboard-interrupt poller. Works transparently on Windows and Posix (Linux, Mac OS X). Doesn’t work with IDLE.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

class lib.keypress.KBHit(is_gui=False)

Creates a KBHit object that you can call to do various keyboard things.

getarrow()

Returns an arrow-key code after kbhit() has been called. Codes are 0 : up 1 : right 2 : down 3 : left Should not be called in the same program as getch().

getch()

Returns a keyboard character after kbhit() has been called. Should not be called in the same program as getarrow().

kbhit()

Returns True if keyboard character was hit, False otherwise.

set_normal_term()

Resets to normal terminal. On Windows this is a no-op.

Classes

KBHit([is_gui])

Creates a KBHit object that you can call to do various keyboard things.

Class Inheritance Diagram

Inheritance diagram of lib.keypress.KBHit