Py5Graphics.stroke_weight()

Sets the width of the stroke used for lines, points, and the border around shapes.

Description

Sets the width of the stroke used for lines, points, and the border around shapes. All widths are set in units of pixels.

Using Py5Graphics.point() with strokeWeight(1) or smaller may draw nothing to the Py5Graphics drawing surface, depending on the graphics settings of the computer. Workarounds include setting the pixel using the Py5Graphics.pixels[] or Py5Graphics.np_pixels[] arrays or drawing the point using either Py5Graphics.circle() or Py5Graphics.square().

This method is the same as stroke_weight() but linked to a Py5Graphics object. To see example code for how it can be used, see stroke_weight().

Underlying Java method: PGraphics.strokeWeight

Syntax

stroke_weight(weight: float, /) -> None

Parameters

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

Updated on September 11, 2021 16:51:34pm UTC