class Term - GabrielSCabrera/Termighty GitHub Wiki

Summary

A live interface that takes control of the terminal environment and efficiently updates what is displayed on the terminal based on the state of its current Grid.

Examples

Creating a Term instance, making it live, and making changes during the session. Note that this should be run from a .py file rather than input directly into an interactive session.

from Termighty import Term, Grid, Pixel

grid_1 = Grid([[Pixel(color_b = 'blue') for i in range(20)] for j in range(10)])
grid_2 = Grid([[Pixel(color_b = 'red') for i in range(20)] for j in range(10)])

term = Term()
term[6:16,30:50] = grid_1

with term:
    for i in range(10):
        term[6:16,30:50] = grid_2
        term.sleep(1)
        term[6:16,30:50] = grid_1
        term.sleep(1)