Open jonathanslenders opened 3 years ago
This would be dope. I've managed to get a mostly working output using Rich with something like:
from io import StringIO
from prompt_toolkit.formatted_text import ANSI
from prompt_toolkit.widgets import Label
from rich.console import Console
console = Console(file=StringIO, force_terminal=True, color_system="truecolor")
# Making a Label
console.print("[bold red]Here is a label!", justify="center")
label = Label(text=console.file.getvalue())
Cool. I would subclass StringIO to make printing automatically update label text.
Look into support for the "Rich" library for definition of formatted text: https://github.com/willmcgugan/rich