InteractiveNode

class visualife.diagrams.InteractiveNode(node, code_snippet, **params)

Bases: visualife.diagrams.NodeBase

Extends InteractiveNode with a code snipped.

This class both contains and extends a NodeBase, calls to the base class are delegated to the node instance

Attributes Summary

bottom Coordinates of the point in the middle of the bottom side of this node
code_snippet Returns the code snippet assigned to this node
height The height of this node.
id Returns ID of this node
left Coordinates of the point in the middle of the left side of this node
node Returns the node object used to display this InteractiveNode
right Coordinates of the point in the middle of the right side of this node
top Coordinates of the point in the middle of the top side of this node
width The width of this node.
x
y

Methods Summary

draw(viewport, **kwargs) Draw this node on a viewport
execute(global_variables, local_variables)
highlight([state]) Highlights this box or turns it back to normal.

Attributes Documentation

bottom

Coordinates of the point in the middle of the bottom side of this node

Abstract method, raises NotImplementedError

code_snippet

Returns the code snippet assigned to this node

Returns:(string) code snippet that will be executed by this node
height

The height of this node.

This property is evaluated as self.bottom.y - self.top.y, so it relies on bottom() and top() implementation of a derived class :return: height of this node.

id

Returns ID of this node

Returns:unique ID of this node
left

Coordinates of the point in the middle of the left side of this node

Abstract method, raises NotImplementedError

node

Returns the node object used to display this InteractiveNode

Returns:(NodeBase) node object
right

Coordinates of the point in the middle of the right side of this node

Abstract method, raises NotImplementedError

top

Coordinates of the point in the middle of the top side of this node

Abstract method, raises NotImplementedError

width

The width of this node.

This property is evaluated as self.right.x - self.left.x, so it relies on left() and right() implementation of a derived class :return: width of this node.

x
y

Methods Documentation

draw(viewport, **kwargs)

Draw this node on a viewport

Abstract method, raises NotImplementedError

Parameters:
execute(global_variables, local_variables)
highlight(state=True)

Highlights this box or turns it back to normal.

Highlighting this node will change it’s fill color to a reddish tint of its existing (standard) color The new color will be visible until clear() is called. This method works only when visualife.core.HtmlViewport is used to render the graphics; otherwise it has no effect.

Parameters:state – (boolean) if True, this node will be highlighted, otherwise any highlight effect

will be cancelled