Sets the style for rendering line endings.


example picture for stroke_cap()
1def setup():
2    py5.stroke_weight(12.0)
3    py5.stroke_cap(py5.ROUND)
4    py5.line(20, 30, 80, 30)
5    py5.stroke_cap(py5.SQUARE)
6    py5.line(20, 50, 80, 50)
7    py5.stroke_cap(py5.PROJECT)
8    py5.line(20, 70, 80, 70)


Sets the style for rendering line endings. These ends are either squared, extended, or rounded, each of which specified with the corresponding parameters: SQUARE, PROJECT, and ROUND. The default cap is ROUND.

To make point() appear square, use stroke_cap(PROJECT). Using stroke_cap(SQUARE) (no cap) causes points to become invisible.

Underlying Processing method: strokeCap


stroke_cap(cap: int, /) -> None


  • cap: int - either SQUARE, PROJECT, or ROUND

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