Skip to content

Ellipse

The Ellipse class represents an SVG ellipse element. It supports setting the center position.

Info

This class inherits from SvgElement.

pydreamplet.core.Ellipse

Ellipse(**kwargs)

Initializes a new ellipse. If pos is provided, it sets the center coordinates.

Parameters

  • **kwargs: Attributes for the ellipse, including pos (a Vector) and other properties (e.g., rx, ry).
from pydreamplet import SVG, Ellipse, Vector

svg = SVG(200, 200)
svg.append(Ellipse(pos=Vector(100, 100), rx=60, ry=40, fill="#a00344"))

Result

pos

Getter: Returns the center of the ellipse as a Vector.

Setter: Updates the center coordinates.

print(ellipse.pos)
ellipse.pos = Vector(120, 90)