vispy.scene.node module

class vispy.scene.node.Node(parent=None, name=None, transforms=None)[source]

Bases: object

Base class representing an object in a scene.

A group of nodes connected through parent-child relationships define a scenegraph. Nodes may have any number of children.

Each Node defines a transform property, which describes the position, orientation, scale, etc. of the Node relative to its parent. The Node’s children inherit this property, and then further apply their own transformations on top of that.

With the transform property, each Node implicitly defines a “local” coordinate system, and the Nodes and edges in the scenegraph can be thought of as coordinate systems connected by transformation functions.


The parent of the Node.


The name used to identify the node.

transformsinstance of TransformSystem | None

The associated transforms.

property canvas

The canvas in which this node’s scenegraph is being drawn.

property children

A copy of the list of children of this node. Do not add items to this list, but use x.parent = y instead.

property clip_children

Boolean indicating whether children of this node will inherit its clipper.

property clipper

A visual filter that can be used to clip visuals to the boundaries of this node.


Return the common parent of two entities

If the entities have no common parent, return None.

nodeinstance of Node

The other node.

parentinstance of Node | None

The parent.


Create tree diagram of children


If true, add information about node transform types.


The tree diagram.

property document

The document is an optional property that is an node representing the coordinate system from which this node should make physical measurements such as px, mm, pt, in, etc. This coordinate system should be used when determining line widths, font sizes, and any other lengths specified in physical units.

The default is None; in this case, a default document is used during drawing (usually this is supplied by the SceneCanvas).

property document_node

The node to be used as the document coordinate system.

By default, the document node is self.root_node.


Check if a node is a child of the current node

nodeinstance of Node

The potential child.


Whether or not the node is a child.

property name

Return two lists describing the path from this node to another

nodeinstance of Node

The other node.


First path (see below).


Second path (see below).


The first list starts with this node and ends with the common parent between the endpoint nodes. The second list contains the remainder of the path from the common parent to the specified ending node.

For example, consider the following scenegraph:

A --- B --- C --- D
                           --- E --- F

Calling D.node_path(F) will return:

([D, C, B], [E, F])

Return a list describing the path from this node to a child node

If node is not a (grand)child of this node, then raise RuntimeError.

nodeinstance of Node

The child node.

pathlist | None

The path.


Return the list of transforms along the path to another node.

The transforms are listed in reverse order, such that the last transform should be applied first when mapping from this node to the other.

nodeinstance of Node

The other node.


A list of Transform instances.


Return the transform that maps from the coordinate system of self to the local coordinate system of node.

Note that there must be a _single_ path in the scenegraph that connects the two entities; otherwise an exception will be raised.

nodeinstance of Node

The other node.

transforminstance of ChainTransform

The transform.


Parent change event handler

eventinstance of Event

The event.

property opacity
property order

A value used to determine the order in which nodes are drawn.

Greater values are drawn later. Children are always drawn after their parent.

property parent

The parent of this node in the scenegraph.

Nodes inherit coordinate transformations and some filters (opacity and clipping by default) from their parents. Setting this property assigns a new parent, changing the topology of the scenegraph.

May be set to None to remove this node (and its children) from a scenegraph.


Return the list of parents starting from this node. The chain ends at the first node with no parents.

property picking

Boolean that determines whether this node (and its children) are drawn in picking mode.

property root_node
property scene_node

The first ancestor of this node that is a SubScene instance, or self if no such node exists.

set_transform(type_, *args, **kwargs)[source]

Create a new transform of type and assign it to this node.

All extra arguments are used in the construction of the transform.


The transform type.




Keywoard arguments.

property transform

The transform that maps the local coordinate frame to the coordinate frame of the parent.


Emit an event to inform listeners that properties of this Node have changed. Also request a canvas update.

property visible

Whether this node should be drawn or not. Only applicable to nodes that can be drawn.