Ellipse

class Ellipse(p1, *args)

An object representing an ellipse or oval

Parameters
  • p1 – a tuple (x, y) in world space

  • *args – either annother tuple (x, y) in world space, or the x and y radii of the ellipse

Raises

TypeError – arguments must be numbers or coordinates

Examples

# Creates an ellipse centered at (50, 100) with a size of (100, 200)

>>> Ellipse((0, 0), (100, 200))

# Creates an ellipse centered at (0, 0) with radii (50, 100)

>>> Ellipse((0, 0), 50, 100)
set_color(*args) None

Sets the fill color of the object

Parameters

*args – a color or 4 colors corresponding to bottom-left, bottom-right, top-right, and top-left

Raises

TypeError – arguments must be colors

Return type

None

set_transparency(*args: float) None

Sets the transparency of the object

Parameters

*args (float) – a float or 4 floats corresponding to bottom-left, bottom-right, top-right, and top-left

Raises
  • TypeError – arguments must be floats

  • ValueError – transparency must be between 0 and 1

Return type

None

class Circle(position: tuple[float, float], radius: float)

An object representing a circle

Parameters
  • position – the center (x, y) in world space

  • radius – the circle’s radius

Raises

TypeError – arguments must be a coordinate and a number