blessed

Build interactive terminal UIs with colors, keyboard input, and positioning

pipmacoslinuxwindows
Try with needOr install directly
Source

About

Easy, practical library for making terminal apps, by providing an elegant, well-documented interface to Colors, Keyboard input, and screen Positioning capabilities.

Examples

create a terminal app with colored text and formatting$ python3 -c "from blessed import Terminal; t = Terminal(); print(t.bold_red('Hello World'))"
get keyboard input and respond to key presses in terminal$ python3 -c "from blessed import Terminal; t = Terminal(); print('Press a key:'); print(t.inkey())"
move cursor to specific position and draw on screen$ python3 -c "from blessed import Terminal; t = Terminal(); print(t.move(5, 10) + 'Text at row 5, col 10')"
build a menu-driven command line interface with color$ python3 -c "from blessed import Terminal; t = Terminal(); print(t.clear()); print(t.green('Welcome')); input(t.cyan('> '))"
detect terminal capabilities and size for responsive UI$ python3 -c "from blessed import Terminal; t = Terminal(); print(f'Size: {t.width}x{t.height}'); print(f'Color support: {t.does_styling}')"