def hidden_cursor ( ) : if sys . stdout . isatty ( ) : _LOGGER . debug ( 'Hiding cursor.' ) print ( '\x1B[?25l' , end = '' ) sys . stdout . flush ( ) try : yield finally : if sys . stdout . isatty ( ) : _LOGGER . debug ( 'Showing cursor.' ) print ( '\n\x1B[?25h' , end = '' ) sys . stdout . flush ( )
python print \033 cursor
Temporarily hide the terminal cursor .
def hidden_cursor():
    """Temporarily hide the terminal cursor."""
    if sys.stdout.isatty():
        _LOGGER.debug('Hiding cursor.')
        print('\x1B[?25l', end='')
        sys.stdout.flush()
    try:
        yield
    finally:
        if sys.stdout.isatty():
            _LOGGER.debug('Showing cursor.')
            print('\n\x1B[?25h', end='')
            sys.stdout.flush()