cb_key_stroke.cb_key_stroke module — cb_key_stroke documentation

# cb_key_stroke.cb_key_stroke module

cb_key_stroke - The python loop key pressed interupt module

cb_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 cb_key_stroke module! Thomas

class cb_key_stroke.cb_key_stroke.CBKeyStroke

  Bases: `CBKeyStrokeBase`

  linux KeyStroke implementation for foreground process’

  classmethod getch()

    Get the pressed character. Check first with kbHit if a key was pressed.

    Returns:

      The pressed character

    Return type:

      char

  classmethod kbhit()

    check if a key was pressed and return it

    Returns:

      True if a character was pressed, False if not

    Return type:

      Bool

class cb_key_stroke.cb_key_stroke.CBKeyStrokeBase

  Bases: `object`

  The KeyStrokeBase class which provides the core and common methods.

  check(keys=['\x1b', 'q'])

    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()

    Just do nothing. This method is overwritten when needed

  classmethod kbhit()

    Just do nothing. This method is overwritten when needed