Visualization controller
gradysim.simulator.extension.visualization_controller.VisualizationController
Bases: Extension
Controller for the visualization handler. Can be used to send commands to the visualization handler from a protocol. Commands can be used to affect the visualization, such as painting nodes or changing the environment's color.
Info
Every method in this class is a no-op if a visualization handler is not active. This includes when the protocol is not running on a python simulation environment.
Warning
This class is an extension and will raise an error if the protocol is not running on a python simulation.
Source code in gradysim\simulator\extension\visualization_controller.py
paint_environment(color)
Paints the environment in the visualization with a specific color.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
color
|
Tuple[float, float, float]
|
RGB color of the environment |
required |
Source code in gradysim\simulator\extension\visualization_controller.py
paint_node(node_id, color)
Paints a node in the visualization with a specific color.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node_id
|
int
|
ID of the node to paint |
required |
color
|
Tuple[float, float, float]
|
RGB color of the node |
required |
Source code in gradysim\simulator\extension\visualization_controller.py
resize_nodes(size)
Resizes the nodes in the visualization Args: size: New size of the nodes
Source code in gradysim\simulator\extension\visualization_controller.py
show_node_id(node_id, show)
Paints or unpaints the node_id text over the node. Args: node_id: ID of the node show: wheter to show the node_id or not