Sets the width of the stroke used for lines, points, and the border around shapes.
1def setup(): 2 py5.stroke_weight(1) # default 3 py5.line(20, 20, 80, 20) 4 py5.stroke_weight(4) # thicker 5 py5.line(20, 40, 80, 40) 6 py5.stroke_weight(10) # beastly 7 py5.line(20, 70, 80, 70)
Sets the width of the stroke used for lines, points, and the border around shapes. All widths are set in units of pixels.
Using point() with
strokeWeight(1) or smaller may draw nothing to the screen, depending on the graphics settings of the computer. Workarounds include setting the pixel using the pixels or np_pixels arrays or drawing the point using either circle() or square().
Underlying Processing method: strokeWeight
stroke_weight(weight: float, /) -> None
weight: float - the weight (in pixels) of the stroke
Updated on November 12, 2021 11:30:58am UTC