Py5Shape.get_stroke_weight()

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

Examples

example picture for get_stroke_weight()
1
2
3
4
5
6
def setup():
    py5.stroke_weight(4)
    s = py5.create_shape(py5.RECT, 20, 20, 60, 60)
    py5.shape(s)

    py5.println(s.get_stroke_weight(0)) # 4.0

Description

Gets 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 get the stroke weight assigned to each vertex, but most likely the value will be the same for all vertices.

This method can only be used for a complete Py5Shape object, and never within a Py5Shape.begin_shape() and Py5Shape.end_shape() pair.

Underlying Java method: PShape.getStrokeWeight

Syntax

get_stroke_weight(index: int, /) -> float

Parameters

  • index: int - vertex index

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