amaze.visu.widgets.maze

Classes

MazeWidget(maze, robot[, config, is_reset])

QtPainter(p, config)

class amaze.visu.widgets.maze.QtPainter(p: QPainter, config: dict)[source]
class amaze.visu.widgets.maze.MazeWidget(
maze: Maze | BuildData | str,
robot: Robot,
config: Dict[str, Any] | None = None,
is_reset=False,
)[source]
static default_config()[source]

Returns the default rendering configuration.

  • solution: show the path the target (True)

  • robot: show the robot (True)

  • dark: use a dark background to see as the robot does (True)

  • colorblind: use a colorblind-friendly palette (False)

  • cycles: detect and simplify cycles when plotting trajectories (True)

minimumSize(self) QSize[source]
resizeEvent(self, a0: QResizeEvent | None)[source]
showEvent(self, a0: QShowEvent | None)[source]
update(self)[source]
update(self, a0: QRect) None
update(self, a0: QRegion) None
update(self, ax: int, ay: int, aw: int, ah: int) None
paintEvent(self, a0: QPaintEvent | None)[source]
render_to_file(
path,
width: int | None = None,
cell_width: int | None = None,
)[source]

Render this widget to a file

Parameters:
  • path – destination path for the resulting image

  • width – requested width of the image

  • cell_width – requested width of a single cell

Returns:

Whether saving was successful

pretty_render(
width: int | None = None,
cell_width: int | None = None,
)[source]

Render this widget to an image

Parameters:
  • width – requested width of the image

  • cell_width – requested width of a single cell

Returns:

The generated image

classmethod static_render_to_file(
maze: Maze,
path: Path,
width: int | None = None,
cell_width: int | None = None,
**kwargs,
)[source]

Render the provided maze to a file (in png format).

Parameters:
  • maze – Maze to render

  • path – destination path for the resulting image

  • width – requested width of the image

  • cell_width – requested width of a single cell

Additional arguments refer to the rendering configuration, see default_config().

Returns:

Whether saving was successful

classmethod plot_trajectory(
simulation: Simulation,
size: int,
trajectory: DataFrame | None = None,
config: dict | None = None,
path: Path | str | None = None,
verbose: int = 0,
side: int = 0,
square: bool = False,
force_overlay: bool = False,
img_format: Format = 4,
) QImage | None[source]

Plots a trajectory stored in the provided simulation to the requested file.

Parameters:
  • simulation – the simulation to plot from

  • size – the width of the generated image (height is deduced)

  • trajectory – the trajectory (in dataframe format)

  • path – where to save the trajectory to (or None to get the image)

  • verbose – whether to provide additional information

  • side – where to put the color bar (<0: left, >0: right, 0: auto)

  • square – whether to generate a square image of size max(w,h)^2

  • force_overlay – whether to always draw the overlay (colorbar + labels)

  • img_format – QImage.Format to use for the underlying QImage

  • config – kw configuration values (see default_config())