Treeform
- class Treeform[source]
Bases:
QTreeWidget
Class for displaying tree-like data. Treeform is an abstract class that could be placed in either the viewport or the sidedock.
- Parameters:
- tree
compas.datastructures.Tree
The tree to be displayed. An typical example is the scene object tree:
compas_viewer.viewer.Viewer._tree
.- columnsdict[str, callable]
A dictionary of column names and their corresponding attributes. Example:
{"Name": (lambda o: o.name), "Object": (lambda o: o)}
- show_headersbool, optional
Show the header of the tree. Defaults to
True
.- stretchint, optional
Stretch factor of the tree in the grid layout. Defaults to
2
.- backgroundsdict[str, callable], optional
A dictionary of column names and their corresponding color. Example:
{"Object-Color": (lambda o: o.surfacecolor)}
- tree
- Attributes:
- tree
compas.datastructures.Tree
The tree to be displayed.
- tree
See also
compas.datastructures.Tree
compas.datastructures.tree.TreeNode
compas_viewer.layout.SidedockLayout
References
Examples
from compas_viewer import Viewer viewer = Viewer() for i in range(10): for j in range(10): sp = viewer.scene.add(Sphere(0.1, Frame([i, j, 0], [1, 0, 0], [0, 1, 0])), name=f"Sphere_{i}_{j}") viewer.layout.sidedock.add_element(Treeform(viewer._tree, {"Name": (lambda o: o.object.name), "Object": (lambda o: o.object)})) viewer.show()
Methods
Inherited Methods