Rect
The Rect class represents an SVG rectangle element. It supports setting the position and provides properties for width and height.
Info
This class inherits from SvgElement.
pydreamplet.core.Rect
Initializes a new rectangle. If pos is provided, it sets the top-left corner.
Parameters
**kwargs: Attributes for the rectangle, includingpos(aVector) and other properties (e.g.,width,height).
from pydreamplet import SVG, Rect, Vector
svg = SVG(200, 200)
svg.append(
Rect(
pos=Vector(50, 50),
width=100,
height=100,
fill="#a00344",
)
)
pos
Getter: Returns the position (top-left corner) as a Vector.
Setter: Updates the position.
width
Returns the width of the rectangle.
height
Returns the height of the rectangle.