PathLayer#

class PathLayer(**properties: Any)#

Superclasses: Layer, Widget, InitiallyUnowned, Object

Implemented Interfaces: Accessible, Buildable, ConstraintTarget

A layer displaying line path between inserted Location objects

This layer shows a connection between inserted objects implementing the Location interface. This means that both Marker objects and Coordinate objects can be inserted into the layer. Of course, custom objects implementing the Location interface can be used as well.

Constructors#

class PathLayer
classmethod new(viewport: Viewport) PathLayer#

Creates a new instance of PathLayer.

Parameters:

viewport – the Viewport

Methods#

class PathLayer
add_node(location: Location) None#

Adds a Location object to the layer. The node is prepended to the list.

Parameters:

location – a Location

get_closed() bool#

Gets information whether the path is closed.

get_dash() list[int]#

Returns the list of dash segment lengths.

get_fill() bool#

Checks whether the path is filled.

get_fill_color() RGBA#

Gets the path’s fill color.

get_nodes() list[Location]#

Gets a copy of the list of all Location objects inserted into the layer. You should free the list but not its contents.

get_outline_color() RGBA#

Gets the path’s outline color.

get_outline_width() float#

Gets the width of the outline.

get_stroke() bool#

Checks whether the path is stroked.

get_stroke_color() RGBA#

Gets the path’s stroke color.

get_stroke_width() float#

Gets the width of the stroke.

insert_node(location: Location, position: int) None#

Inserts a Location object to the specified position.

Parameters:
  • location – a Location

  • position – position in the list where the Location object should be inserted

remove_all() None#

Removes all Location objects from the layer.

remove_node(location: Location) None#

Removes the Location object from the layer.

Parameters:

location – a Location

set_closed(value: bool) None#

Makes the path closed.

Parameters:

valueTrue to make the path closed

set_dash(dash_pattern: list[int]) None#

Sets dashed line pattern in a way similar to cairo_set_dash() of cairo. This method supports only integer values for segment lengths. The values have to be passed inside the data pointer of the list (using the %GUINT_TO_POINTER conversion)

Pass None to use solid line.

Parameters:

dash_pattern – list of integer values representing lengths of dashes/spaces (see cairo documentation of cairo_set_dash())

set_fill(value: bool) None#

Sets the path to be filled

Parameters:

value – if the path is filled

set_fill_color(color: RGBA | None = None) None#

Set the path’s fill color.

Parameters:

color – The path’s fill color or None to reset to the default color. The color parameter is copied.

set_outline_color(color: RGBA | None = None) None#

Set the path’s outline color.

Parameters:

color – The path’s outline color or None to reset to the default color. The color parameter is copied.

set_outline_width(value: float) None#

Sets the width of the outline

Parameters:

value – the width of the outline (in pixels)

set_stroke(value: bool) None#

Sets the path to be stroked

Parameters:

value – if the path is stroked

set_stroke_color(color: RGBA | None = None) None#

Set the path’s stroke color.

Parameters:

color – The path’s stroke color or None to reset to the default color. The color parameter is copied.

set_stroke_width(value: float) None#

Sets the width of the stroke

Parameters:

value – the width of the stroke (in pixels)

Properties#

class PathLayer
props.closed: bool#

The type of the None singleton.

props.fill: bool#

The type of the None singleton.

props.fill_color: RGBA#

The type of the None singleton.

props.outline_color: RGBA#

The type of the None singleton.

props.outline_width: float#

The type of the None singleton.

props.stroke: bool#

The type of the None singleton.

props.stroke_color: RGBA#

The type of the None singleton.

props.stroke_width: float#

The type of the None singleton.