class neoscore.core.pen.Pen[source]

Bases: object

A pen describing how shape outlines are drawn.

__init__(color: Optional[ColorDef] = None, thickness: Optional[Unit] = ZERO, pattern: PenPattern = PenPattern.SOLID, join_style: PenJoinStyle = PenJoinStyle.MITER, cap_style: PenCapStyle = PenCapStyle.FLAT)[source]
  • color – The stroke color. Defaults to black unless changed globally by neoscore.set_default_color.

  • thickness – The stroke thickness. A value of ZERO (the default) indicates a display pixel width.

  • pattern – The stroke pattern. Defaults to a solid line.

  • join_style – The appearance of line joints. Defaults to a bevel join

  • cap_style – The appearance of line ends. Defaults to a flat cap

classmethod from_existing(pen: Pen, color: Optional[ColorDef] = None, thickness: Optional[Unit] = None, pattern: Optional[PenPattern] = None, join_style: Optional[PenJoinStyle] = None, cap_style: Optional[PenCapStyle] = None) Pen[source]

Derive a pen from another, overriding any provided fields.

classmethod no_pen() Pen[source]

Create a non-drawing pen.

classmethod from_def(pen_def: PenDef) Pen[source]
property color: Color

The color for the pen.

This can be set with a ColorDef shorthand.

property thickness: Unit

The pen stroke thickness.

property pattern: PenPattern

The stroke pattern.

property join_style: PenJoinStyle

The style of line sharp line joins.

This style has no effect on curved paths.

property cap_style: PenCapStyle

the style of unclosed path caps with this pen.

This style has no effect on closed paths.

property interface: PenInterface

A Pen or a color hex string to be passed to an otherwise default Pen.

alias of Union[Pen, str]