How to have two Renderables on a single line with Tree? #2404
-
I'm trying to put two Renderables on a single tree line but can't figure out how. I tried with from rich.console import Group, Console
from rich.pretty import Pretty
from rich.text import Text
from rich.tree import Tree
console = Console()
d = {"Hello", "world"}
tree = Tree("hello")
tree.add(Group(Text("World"), Pretty(d)))
console.print(tree) Is there a way to have the pretty printed set on the same line as the text? |
Beta Was this translation helpful? Give feedback.
Answered by
willmcgugan
Jul 18, 2022
Replies: 1 comment 1 reply
-
Sure. You can use from rich.columns import Columns
from rich.console import Group, Console
from rich.pretty import Pretty
from rich.text import Text
from rich.tree import Tree
console = Console()
d = {"Hello", "world"}
tree = Tree("hello")
tree.add(Columns([Text("World"), Pretty(d)]))
console.print(tree) |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
abey79
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sure. You can use
rich.columns,Columns
here.