rich

get tree view from a dictionary with anytree or rich, or treelib

get tree view from a dictionary with anytree or rich, or treelib Question: I read the manual from https://anytree.readthedocs.io/en/latest/#, but I didn’t figure out how to translate a dictionary to tree view, anyone can help? data = { ‘Marc’: ‘Udo’, ‘Lian’: ‘Marc’, ‘Dan’: ‘Udo’, ‘Jet’: ‘Dan’, ‘Jan’: ‘Dan’, ‘Joe’: ‘Dan’, } output is Udo ├── …

Total answers: 1

Pre-existing high-contrast palettes from the ANSI color set, to use in a terminal app?

Pre-existing high-contrast palettes from the ANSI color set, to use in a terminal app? Question: Looking to convey more information in a Rich Table by using colors (specifically to track which modules given classes come from). On the web, it’s fairly easy on find color palettes that are optimized for contrast, rather than esthetics. Here’s …

Total answers: 2

Reset a Table with Rich in Python, or delete a row?

Reset a Table with Rich in Python, or delete a row? Question: How could I erase a row table in rich? (Erase the rows or reset all the table) ex. How could I reset tableTest or erase a row? from rich.console import Console from rich.table import Table tableTest = Table(title="Star Wars Movies") tableTest.add_column("Released", justify="right", style="cyan", …

Total answers: 2

Why can't Python rich print text styles, only colors, on Windows command line?

Why can't Python rich print text styles, only colors, on Windows command line? Question: The problem is that I can’t print any text style. This is my code, and I don’t think it’s faulty: from rich.console import Console console = Console(highlight=False) console.print("Test print") console.print("[green]Test print (green)") console.print("[bold]Test print (bold)") console.print("[bold underline]Test print (bold underline)") input() …

Total answers: 2

Textual (python) – how to add click event in simple Text object?

Textual (python) – how to add click event in simple Text object? Question: I’m trying to get it so I can add links in text rendered by Textual. My text may have multiple links, for example: Hello [@click=hello]World[/] there, how are you? This is a test of [@click=more] more info[/] being clickable as well. In …

Total answers: 2

Getting a Prompt inside a Layout using Python Rich

Getting a Prompt inside a Layout using Python Rich Question: Is it possible to get user input using a Prompt within a Layout element using Python Rich? My aim is to use Rich’s Layout to build a full-screen window with 4 panes. The top 3, containing title, ingredients and method work fine, but I would …

Total answers: 2

ModuleNotFoundError: No module named 'rich.logging' in python

ModuleNotFoundError: No module named 'rich.logging' in python Question: I have init.py that includes this code and I get the error below the code: from __future__ import annotations import logging from rich.logging import RichHandler FORMAT = "%(message)s" logging.basicConfig( format=FORMAT, datefmt="[%X] ", handlers=[RichHandler()], level=logging.INFO, ) from . import ai from . import cli from . import clustering …

Total answers: 2

Set different background color using Rich

Set different background color using Rich Question: I found useful package rich. And want to use it in the next way: drawing in different colors words in sentence and at different background colors. I use next code: from rich.console import Console console = Console() console.print(‘[green]some[/green] [#F47983]text[/#F47983]’) This way I can set any color for any …

Total answers: 1