qgym.utils.visualisation.wrappers module

This module contains wrappers around some commonly used pygame functions.

qgym.utils.visualisation.wrappers.draw_point(screen, pos, color, r=10)[source]

Draw a point on the screen.

Parameters:
  • screen (Surface) – Screen to add the point to.

  • pos (ArrayLike) – ArrayLike containing the x and y coordinates of the point. Non integer values will be rounded down to the nearest integer.

  • r (int) – Radius of the point (in pixels). Defaults to 10.

Return type:

None

qgym.utils.visualisation.wrappers.draw_wide_line(screen, color, point1, point2, *, width=2)[source]

Draw a wide line on the screen.

Parameters:
  • screen (Surface) – Screen to draw the line on.

  • color (Tuple[int, int, int]) – Color of the line.

  • point1 (ArrayLike) – Coordinates of the starting point of the line.

  • point2 (ArrayLike) – Coordinates of the end point of the line.

  • width (int) – Width of the line. Defaults to 2.

Return type:

None

qgym.utils.visualisation.wrappers.shade_rect(screen, size, pos, color, alpha)[source]

Shade a rectangular area.

Parameters:
  • screen (Surface) – Screen to draw the shade on.

  • size (ArrayLike) – Width and height of the rectangular area.

  • pos (ArrayLike) – The x,y-coordinates of the lower left corner of the rectangle.

  • color (Tuple[int, int, int]) – Color of the shaded area.

  • alpha (int) – Alpha of the shade.

Return type:

None

qgym.utils.visualisation.wrappers.write_text(screen, font, text, pos, color)[source]

Write text, centered around the given point.

Parameters:
  • screen (Surface) – Screen to write the text on.

  • font (Font) – Font to use.

  • text (str) – Text to write.

  • pos (ArrayLike) – x and y coordinates of the center of the text.

  • color (Tuple[int, int, int]) – Color of the text.

Return type:

None