GUI Entities

class discopygal.gui.RCircleSegment.RCircleSegment(radius: float, center_x: float, center_y: float, start_angle: float, end_angle: float, clockwise, line_width: float, line_color=2, fill_color=19)

A class that represents a circle segment on screen (as a Qt5 object) A circle segment is a non-linear connected curve that is contained in some circle In this representation, it is made of a circle plus start and end angles

Parameters:
  • radius (float) – radius of circle

  • center_x (float) – x position of circle center

  • center_y (float) – y position of circle center

  • start_angle (float) – start angle of circle segment

  • end_angle (float) – end angle of circle segment

  • clockwise (bool) – draw from start to end clockwise or counter-clockwise

  • line_width (int) – width of the boundary of the circle segment

  • line_color (QtGui.QColor) – color of the circle segment

  • fill_color (QtGui.QColor) – color of the interior of circle

class discopygal.gui.RDisc.RDisc(r, x, y, color, line_color, line_width)

A class that represents a disc on screen (as a Qt5 object)

Parameters:
  • r (float) – radius of disc

  • x (float) – x location of disc

  • y (float) – y location of disc

  • color (QtGui.QColor) – color of the interior of disc

  • line_color (QtGui.QColor) – color of the boundary of disc

  • line_width (int) – width of the boundary of disc

x()

Return x position of the center of disc

Returns:

x position of the center of disc

Return type:

float

y()

Return y position of the center of disc

Returns:

y position of the center of disc

Return type:

float

class discopygal.gui.RDiscRobot.RDiscRobot(r: float, x: float, y: float, color, line_width: float, line_color=2, text='')

A class that represents a disc robot on screen (as a Qt5 object) Similar to RDisc, but has text description (number) capability

Parameters:
  • r (float) – radius of disc

  • x (float) – x location of disc

  • y (float) – y location of disc

  • color (QtGui.QColor) – color of the interior of disc

  • line_width (int) – width of the boundary of disc

  • text (str) – the text description (number) of the robot

set_text(text: str)

Set the robot’s text description (number)

Parameters:

text (str) – robot text description

x() float

Return x position of the center of disc robot

Returns:

x position of the center of disc robot

Return type:

float

y() float

Return y position of the center of disc robot

Returns:

y position of the center of disc robot

Return type:

float

class discopygal.gui.RPolygon.RPolygon(points, line_color, fill_color, line_width, text='', pos=None)

A class that represents a polygon on screen (as a Qt5 object)

Parameters:
  • points (list<(float, float)>) – list of points of the polygon

  • line_color (QtGui.QColor) – color of the boundary of polygon

  • fill_color (QtGui.QColor) – color of the interior of polygon

  • line_width (int) – width of the boundary of polygon

  • pos (QtCore.QPointF) – initial position of polygon (used for animation). If none first vertex is chosen.

points()

Return a list of polygon’s vertices

Returns:

list polygon vertices

Return type:

list<QPointF>

x()

Return x position of the first vertex in polygon

Returns:

x position of the first vertex in polygon

Return type:

float

y()

Return y position of the first vertex in polygon

Returns:

y position of the first vertex in polygon

Return type:

float

class discopygal.gui.RPolygonWithHoles.RPolygonWithHoles(points, holes, line_color, fill_color, line_width)

A class that represents a polygon with holes on screen (as a Qt5 object)

Parameters:
  • points (list<(float, float)>) – list of points of the polygon

  • holes (list<list<(float, float)>>) – list of holes, each hole is a list of points

  • line_color (QtGui.QColor) – color of the boundary of polygon

  • fill_color (QtGui.QColor) – color of the interior of polygon

  • line_width (int) – width of the boundary of polygon

points()

Return a list of polygon’s vertices

Returns:

list polygon vertices

Return type:

list<QPointF>

x()

Return x position of the first vertex in polygon

Returns:

x position of the first vertex in polygon

Return type:

float

y()

Return y position of the first vertex in polygon

Returns:

y position of the first vertex in polygon

Return type:

float

class discopygal.gui.RSegment_angle.RSegment_angle(x1, y1, l, a, line_color, line_width)

A class that represents an angled linear segment on screen (as a Qt5 object) The segment is defined with its start position, its length and the angle (Instead of start and end position like in RSegment)

Parameters:
  • x1 (float) – x position of start endpoint

  • y1 (float) – y position of start endpoint

  • l (float) – length of the segment

  • a (float) – angle (in radians) af the segment

  • line_color (QtGui.QColor) – color of the segment

  • line_width (int) – width of segment

angle()

Return the angle of the segment

Returns:

angle of segment

Return type:

float

x()

Return x position of the start endpoint of segment

Returns:

x position of the start endpoint of segment

Return type:

float

y()

Return y position of the start endpoint of segment

Returns:

y position of the start endpoint of segment

Return type:

float

class discopygal.gui.RSegment.RSegment(x1, y1, x2, y2, color, line_width, opacity)

A class that represents a linear segment on screen (as a Qt5 object) The segment is defined with its start and end positions of endpoints (Instead of start position, length and angle like in RSegment_angle)

Parameters:
  • x1 (float) – x position of start endpoint

  • y1 (float) – y position of start endpoint

  • x2 (float) – x position of end endpoint

  • y2 (float) – y position of end endpoint

  • color (QtGui.QColor) – color of the segment

  • line_width (int) – width of segment

x()

Return x position of the start endpoint of segment

Returns:

x position of the start endpoint of segment

Return type:

float

y()

Return y position of the start endpoint of segment

Returns:

y position of the start endpoint of segment

Return type:

float

class discopygal.gui.RText.RText(text, x, y, size, color)

A class that represents a text label on screen (as a Qt5 object)

Parameters:
  • text (str) – text label

  • x (float) – x position of text label

  • y (float) – y position of text label

  • size (int) – size of label

  • color (QtGui.QColor) – color of the label