Add a child tree. Args: label (RenderableType): The renderable or str for the tree label. style (StyleType, optional): Style of this tree. Defaults to "tree". guide_style (StyleType, optional): Style of the guide lines. Defaults to "tree.line".
(
self,
label: RenderableType,
*,
style: Optional[StyleType] = None,
guide_style: Optional[StyleType] = None,
expanded: bool = True,
highlight: Optional[bool] = False,
)
| 53 | self.hide_root = hide_root |
| 54 | |
| 55 | def add( |
| 56 | self, |
| 57 | label: RenderableType, |
| 58 | *, |
| 59 | style: Optional[StyleType] = None, |
| 60 | guide_style: Optional[StyleType] = None, |
| 61 | expanded: bool = True, |
| 62 | highlight: Optional[bool] = False, |
| 63 | ) -> "Tree": |
| 64 | """Add a child tree. |
| 65 | |
| 66 | Args: |
| 67 | label (RenderableType): The renderable or str for the tree label. |
| 68 | style (StyleType, optional): Style of this tree. Defaults to "tree". |
| 69 | guide_style (StyleType, optional): Style of the guide lines. Defaults to "tree.line". |
| 70 | expanded (bool, optional): Also display children. Defaults to True. |
| 71 | highlight (Optional[bool], optional): Highlight renderable (if str). Defaults to False. |
| 72 | |
| 73 | Returns: |
| 74 | Tree: A new child Tree, which may be further modified. |
| 75 | """ |
| 76 | node = Tree( |
| 77 | label, |
| 78 | style=self.style if style is None else style, |
| 79 | guide_style=self.guide_style if guide_style is None else guide_style, |
| 80 | expanded=expanded, |
| 81 | highlight=self.highlight if highlight is None else highlight, |
| 82 | ) |
| 83 | self.children.append(node) |
| 84 | return node |
| 85 | |
| 86 | def __rich_console__( |
| 87 | self, console: "Console", options: "ConsoleOptions" |