(self)
Read keypress from console. Non-blocking.
        Returns tuple (unicode, keycode, set of mods)
Read keypress from console. Non-blocking.
        Returns tuple (unicode, keycode, set of mods)
Read keypress from console . Non - blocking . Returns tuple ( unicode keycode set of mods )
def read_key(self):
        """
        Read keypress from console. Non-blocking.
        Returns tuple (unicode, keycode, set of mods)
        """
        sequence = read_all_available(stdio.stdin)
        if sequence is None:
            # stream closed, send ctrl-d
            return u'\x04', 'd', {'CTRL'}
        elif not sequence:
            return u'', None, set()
        # ansi sequences start with ESC (\x1b), but let ESC by itself through
        if len(sequence) > 1 and sequence[0] == u'\x1b':
            # drop unrecognised sequences
            key, mod = ANSI_TO_KEYMOD.get(sequence, (u'', ()))
            return u'', key, mod
        else:
            return sequence, None, set()
def read_key ( self ) : sequence = read_all_available ( stdio . stdin ) if sequence is None : # stream closed, send ctrl-d return u'\x04' , 'd' , { 'CTRL' } elif not sequence : return u'' , None , set ( ) # ansi sequences start with ESC (\x1b), but let ESC by itself through if len ( sequence ) > 1 and sequence [ 0 ] == u'\x1b' : # drop unrecognised sequences key , mod = ANSI_TO_KEYMOD . get ( sequence , ( u'' , ( ) ) ) return u'' , key , mod else : return sequence , None , set ( )