Drawing Paths

Using bezier paths.


Create a new path.


Move to a point x, y.


Line to a point x, y.

curveTo(xy1, xy2, xy3)

Curve to a point x3, y3. With given bezier handles x1, y1 and x2, y2.


Quadratic curve with a given set of off curves to a on curve.

arc(center, radius, startAngle, endAngle, clockwise)

Arc with center and a given radius, from startAngle to endAngle, going clockwise if clockwise is True and counter clockwise if clockwise is False.

arcTo(xy1, xy2, radius)

Arc from one point to an other point with a given radius.


Close the path.


Draw the current path, or draw the provided path.

# create a new empty path
# set the first oncurve point
moveTo((100, 100))
# line to from the previous point to a new point
lineTo((100, 900))
lineTo((900, 900))

# curve to a point with two given handles
curveTo((900, 500), (500, 100), (100, 100))

# close the path
# draw the path

Use the given path as a clipping path, or the current path if no path was given.

Everything drawn after a clipPath() call will be clipped by the clipping path. To “undo” the clipping later, make sure you do the clipping inside a with savedState(): block, as shown in the example.

# create a bezier path
path = BezierPath()
# draw a triangle
# move to a point
path.moveTo((100, 100))
# line to a point
path.lineTo((100, 900))
path.lineTo((900, 900))
# close the path
# save the graphics state so the clipping happens only
# temporarily
with savedState():
    # set the path as a clipping path
    # the oval will be clipped inside the path
    oval(100, 100, 800, 800)
# no more clipping here