Scale

class Scale(**properties: Any)

Superclasses: Widget, InitiallyUnowned, Object

Implemented Interfaces: Accessible, Buildable, ConstraintTarget

A widget displaying a scale.

CSS nodes

map-scale
├── label[.metric][.imperial]

ShumateScale uses a single CSS node with name map-scale, it has up to two childs different labels.

Constructors

class Scale
classmethod new(viewport: Viewport | None = None) Scale

Creates an instance of Scale.

Parameters:

viewport – a Viewport

Methods

class Scale
get_max_width() int

Gets the maximum scale width.

get_unit() Unit

Gets the unit used by the scale.

get_viewport() Viewport | None

Gets the viewport used by the scale.

set_max_width(value: int) None

Sets the maximum width of the scale on the screen in pixels

Parameters:

value – the number of pixels

set_unit(unit: Unit) None

Sets the scale unit.

Parameters:

unit – a Unit

set_viewport(viewport: Viewport | None = None) None

Sets the scale viewport.

Parameters:

viewport – a Viewport

Properties

class Scale
props.max_width: int

The size of the map scale on screen in pixels.

props.unit: Unit

The scale’s units.

props.viewport: Viewport

The viewport to use.