treescope_part_from_display_object#
- treescope.figures.treescope_part_from_display_object(value: Any) rendering_parts.RenderableTreePart [source]#
Converts an arbitrary object to a renderable treescope part if possible.
Behavior depends on the type of
value
:If
value
is an instance ofTreescopeFigure
, unwraps the underlying treescope part.If
value
is a string, returns a rendering of that string.If
value
has a_repr_html_
method (but isn’t an instance ofTreescopeFigure
), returns an embedded iframe with the given HTML contents.Otherwise, renders the value using the default treescope renderer, but strips off any top-level comments / copy button annotations.
The typical use is to provide helper constructors for containers to allow rendering lots of different objects in the “obvious” way.
- Parameters:
value – Value to wrap.
- Returns:
A renderable treescope part showing the value.