Path
Examples#
See these.
Path
#
Bases: Shape
Draws a path with given elements
with the given paint
.
Whether this shape is filled, stroked, or both, is controlled by paint.style
.
If the path is filled, then sub-paths within it are implicitly closed
(see Path.Close
).
page
#
The page (of type Page
or PageView
) to which this control belongs to.
parent
#
parent: BaseControl | None
The direct ancestor(parent) of this control.
It defaults to None
and will only have a value when this control is mounted (added to the page tree).
The Page
control (which is the root of the tree) is an exception - it always has parent=None
.
Arc
#
Bases: PathElement
Adds a new sub-path with one arc segment that consists of the arc that follows
the edge of the oval bounded by the given rectangle with top left corner at x
and y
and dimensions width
and height
, from start_angle
radians around
the oval up to start_angle
+ sweep_angle
radians around the oval, with zero
radians being the point on the right hand side of the oval that crosses the
horizontal line that intersects the center of the rectangle and with positive
angles going clockwise around the oval.
ArcTo
#
Bases: PathElement
Appends up to four conic curves weighted to describe an oval of radius
and
rotated by rotation
(measured in degrees and clockwise).
The first curve begins from the last point in the path and the last ends at x
and y
. The curves follow a path in a direction determined by clockwise
(bool) and large_arc
(bool) in such a way that the sweep angle is always less
than 360 degrees.
A simple line is appended if either either radii are zero or the last point in
the path (x
,y
). The radii are scaled to fit the last path point if both are
greater than zero but too small to describe an arc.
Close
#
Bases: PathElement
Closes the last sub-path, as if a straight line had been drawn from the current point to the first point of the sub-path.
CubicTo
#
LineTo
#
Bases: PathElement
Adds a straight line segment from the current point to the given point
(x
,y
).
MoveTo
#
Oval
#
Bases: PathElement
Adds a new sub-path that consists of a curve that forms the ellipse that fills the given rectangle.
PathElement
#
QuadraticTo
#
Bases: PathElement
Adds a bezier segment that curves from the current point to the given point
(x
,y
), using the control points (cp1x
,cp1y
) and the weight w
.
Rect
#
Bases: PathElement
Adds a rectangle as a new sub-path.
border_radius
#
border_radius: BorderRadiusValue | None = None
Optional border radius to round rectangle corners.
SubPath
#
Bases: PathElement
Adds the sub-path described by elements
to the given point (x
,y
).
before_update
#
This method is called every time when this control is being updated.
Note
Make sure not to call/request an update()
here.