Py5Shape.stroke_weight()

Py5Shape.stroke_weight()#

Sets the width of the stroke used for lines and points in a Py5Shape object.

Examples#

example picture for stroke_weight()

def make_line(weight):
    s = py5.create_shape()
    s.begin_shape()
    s.stroke_weight(weight)
    s.vertex(20, 0)
    s.vertex(80, 0)
    s.end_shape()
    return s


def setup():
    py5.shape(make_line(1), 0, 20) # default
    py5.shape(make_line(4), 0, 40)
    py5.shape(make_line(10), 0, 70)

Description#

Sets the width of the stroke used for lines and points in a Py5Shape object. All widths are set in units of pixels.

This method can only be used within a Py5Shape.begin_shape() and Py5Shape.end_shape() pair.

Underlying Processing method: PShape.strokeWeight

Signatures#

stroke_weight(
    weight: float,  # the weight (in pixels) of the stroke
    /,
) -> None

Updated on March 06, 2023 02:49:26am UTC