simplay.visualization — Visualization

class simplay.visualization.VisualGrid(width: int, height: int, cols: int, rows: int)

This class represents a grid for the visualization.

Parameters:
  • width – The width of the grid in pixels.

  • height – The height of the grid in pixels.

  • cols – The number of columns in the grid.

  • rows – The number of rows in the grid.

set_area(id: str, name: str, height: int, width: int, x: int, y: int, color: int)

Set an area in the grid.

Parameters:
  • id – The id of the area.

  • name – The name of the area.

  • height – The height of the area in rows.

  • width – The width of the area in columns.

  • x – The x coordinate (column) of the top left corner of the area.

  • y – The y coordinate (row) of the top left corner of the area.

  • color – The color of the area.

Raises:
  • TypeError – If the id is not a string.

  • TypeError – If the name is not a string.

  • TypeError – If the height is not a positive integer.

  • TypeError – If the width is not a positive integer.

  • TypeError – If the x is not an integer.

  • TypeError – If the y is not an integer.

  • TypeError – If the color is not an integer.

  • ValueError – If the id is not unique.

  • ValueError – If the area overlaps with another area.

  • ValueError – If x is negative or greater than the number of columns.

  • ValueError – If y is negative or greater than the number of rows.

  • ValueError – If x + width is greater than the number of columns.

  • ValueError – If y + height is greater than the number of rows.