key_stroke.key_stroke module
key_stroke - The python loop key pressed interupt module
key_stroke is a small module to quit/terminate a loop of a console app
by simply pressing a key. The beauty is that this module is running on Linux,
Öpfel-Rechnern as well Fenster operated computers.
Have fun while using the key_stroke module!
Thomas
-
class key_stroke.key_stroke.KeyStroke[source]
Bases: KeyStrokeBase
linux KeyStroke implementation for foreground process’
-
classmethod getch()[source]
Get the pressed character. Check first with kbHit if a key was
pressed.
- Returns:
The pressed character
- Return type:
char
-
classmethod kbhit()[source]
check if a key was pressed and return it
- Returns:
True if a character was pressed, False if not
- Return type:
Bool
-
class key_stroke.key_stroke.KeyStrokeBase[source]
Bases: object
The KeyStrokeBase class which provides the core and common methods.
-
check(keys=['\x1b', 'q'])[source]
Checks whether a button from the keys list has been pressed.
- Parameters:
keys (list) – List of keys to check
- Returns:
True if a key was pressed, False if not
- Return type:
Bool
-
classmethod getch()[source]
Just do nothing. This method is overwritten when needed
-
classmethod kbhit()[source]
Just do nothing. This method is overwritten when needed