Skip to content

StrokePattern

StrokePattern #

Determines whether a stroke should be solid, dotted, or dashed, and the exact characteristics of each.

This is an abstract class and shouldn't be used directly.

See usable derivatives: - SolidStrokePattern - DashedStrokePattern - DottedStrokePattern

SolidStrokePattern #

Bases: StrokePattern

A solid/unbroken stroke pattern.

DashedStrokePattern #

Bases: StrokePattern

A stroke pattern of alternating dashes and gaps, defined by segments.

RAISES DESCRIPTION
AssertionError

If segments does not contain at least two items, or has an odd length.

pattern_fit #

pattern_fit: PatternFit = SCALE_UP

Determines how this stroke pattern should be fit to a line when their lengths are not equal or multiples.

segments #

segments: list[Number] = field(default_factory=list)

A list of alternating dash and gap lengths, in pixels.

Note

Must contain at least two items, and have an even length.

DottedStrokePattern #

Bases: StrokePattern

A stroke pattern of circular dots, spaced with spacing_factor.

RAISES DESCRIPTION
AssertionError

If spacing_factor is negative.

pattern_fit #

pattern_fit: PatternFit = SCALE_UP

Determines how this stroke pattern should be fit to a line when their lengths are not equal or multiples.

spacing_factor #

spacing_factor: Number = 1.5

The multiplier used to calculate the spacing between dots in a dotted polyline, with respect to Polyline.stroke_width / Polygon.border_stroke_width. A value of 1.0 will result in spacing equal to the stroke_width. Increasing the value increases the spacing with the same scaling.

May also be scaled by the use of PatternFit.SCALE_UP.

Note

Must be non-negative.