Py5Shape.stroke_weight()#

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

Examples#

example picture for stroke_weight()
 1def make_line(weight):
 2    s = py5.create_shape()
 3    s.begin_shape()
 4    s.stroke_weight(weight)
 5    s.vertex(20, 0)
 6    s.vertex(80, 0)
 7    s.end_shape()
 8    return s
 9
10
11def setup():
12    py5.shape(make_line(1), 0, 20) # default
13    py5.shape(make_line(4), 0, 40)
14    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

Syntax#

stroke_weight(weight: float, /) -> None

Parameters#

  • weight: float - the weight (in pixels) of the stroke

Updated on November 12, 2021 11:30:58am UTC