class pyqtgraph.flowchart.Node(name, terminals=None, allowAddInput=False, allowAddOutput=False, allowRemove=True)[source]#

Node represents the basic processing unit of a flowchart. A Node subclass implements at least:

  1. A list of input / output terminals and their properties

  2. a process() function which takes the names of input terminals as keyword arguments and returns a dict with the names of output terminals as keys.

A flowchart thus consists of multiple instances of Node subclasses, each of which is connected to other by wires between their terminals. A flowchart is, itself, also a special subclass of Node. This allows Nodes within the flowchart to connect to the input/output nodes of the flowchart itself.

Optionally, a node class can implement the ctrlWidget() method, which must return a QWidget (usually containing other widgets) that will be displayed in the flowchart control panel. Some nodes implement fairly complex control widgets, but most nodes follow a simple form-like pattern: a list of parameter names and a single value (represented as spin box, check box, etc..) for each parameter. To make this easier, the CtrlNode subclass allows you to instead define a simple data structure that CtrlNode will use to automatically generate the control widget.

__init__(name, terminals=None, allowAddInput=False, allowAddOutput=False, allowRemove=True)[source]#



The name of this specific node instance. It can be any string, but must be unique within a flowchart. Usually, we simply let the flowchart decide on a name when calling Flowchart.addNode(…)


Dict-of-dicts specifying the terminals present on this Node. Terminal specifications look like:

'inputTerminalName': {'io': 'in'}
'outputTerminalName': {'io': 'out'}

There are a number of optional parameters for terminals: multi, pos, renamable, removable, multiable, bypass. See the Terminal class for more information.


bool; whether the user is allowed to add inputs by the context menu.


bool; whether the user is allowed to add outputs by the context menu.


bool; whether the user is allowed to remove this node by the context menu.

addInput(name='Input', **args)[source]#

Add a new input terminal to this Node with the given name. Extra keyword arguments are passed to Terminal.__init__.

This is a convenience function that just calls addTerminal(io=’in’, …)

addOutput(name='Output', **args)[source]#

Add a new output terminal to this Node with the given name. Extra keyword arguments are passed to Terminal.__init__.

This is a convenience function that just calls addTerminal(io=’out’, …)

addTerminal(name, **opts)[source]#

Add a new terminal to this Node with the given name. Extra keyword arguments are passed to Terminal.__init__.

Causes sigTerminalAdded to be emitted.


Set whether this node should be bypassed.

When bypassed, a Node’s process() method is never called. In some cases, data is automatically copied directly from specific input nodes to output nodes instead (see the bypass argument to Terminal.__init__). This is usually called when the user disables a node from the flowchart control panel.


Cleans up after the node–removes terminals, graphicsItem, widget

connected(localTerm, remoteTerm)[source]#

Called whenever one of this node’s terminals is connected elsewhere.


Return this Node’s control widget.

By default, Nodes have no control widget. Subclasses may reimplement this method to provide a custom widget. This method is called by Flowcharts when they are constructing their Node list.


Return the list of nodes which provide direct input to this node

disconnected(localTerm, remoteTerm)[source]#

Called whenever one of this node’s terminals is disconnected from another.


Return the GraphicsItem for this node. Subclasses may re-implement this method to customize their appearance in the flowchart.


Return a dict of all input values currently assigned to this node.


Return dict of all input terminals. Warning: do not modify.


Return True if this Node is currently bypassed.


Return the name of this node.


Return an unused terminal name


Return a dict of all output values currently generated by this node.


Return dict of all output terminals. Warning: do not modify.


Process data through this node. This method is called any time the flowchart wants the node to process data. It will be called with one keyword argument corresponding to each input terminal, and must return a dict mapping the name of each output terminal to its new value.

This method is also called with a ‘display’ keyword argument, which indicates whether the node should update its display (if it implements any) while processing this data. This is primarily used to disable expensive display operations during batch processing.


Called when the flowchart would normally call Node.process, but this node is currently bypassed. The default implementation looks for output terminals with a bypass connection and returns the corresponding values. Most Node subclasses will _not_ need to reimplement this method.


Remove the specified terminal from this Node. May specify either the terminal’s name or the terminal itself.

Causes sigTerminalRemoved to be emitted.


Rename this node. This will cause sigRenamed to be emitted.


Restore the state of this node from a structure previously generated by saveState().


Return a dictionary representing the current state of this node (excluding input / output values). This is used for saving/reloading flowcharts. The default implementation returns this Node’s position, bypass state, and information about each of its terminals.

Subclasses may want to extend this method, adding extra keys to the returned dict.


Set the values on input terminals. For most nodes, this will happen automatically through Terminal.inputChanged. This is normally only used for nodes with no connected inputs.

terminalRenamed(term, oldName)[source]#

Called after a terminal has been renamed

Causes sigTerminalRenamed to be emitted.


Collect all input values, attempt to process new output values, and propagate downstream. Subclasses should call update() whenever thir internal state has changed (such as when the user interacts with the Node’s control widget). Update is automatically called when the inputs to the node are changed.