package documentation

Undocumented

From __init__.py:

Function mm_to_px Converts millimetres to pixel.
Function msize_to_mm Converts a rectangle description of any unit to millimetres.
Function msize_to_px Converts a rectangle description of any unit to pixels.
Function parse Parse a measurement in the string or numeric form.
Function parse_duration Converts weeks, days, hours or minutes to seconds.
Function px_to_mm Converts pixel to millimetres.
Function res_to_scale Converts the user's resolution to the scale.
Function scale_to_res Converts the scale to the user's resolution.
Function size_mm_to_px Converts a rectangle description in millimetres to pixels.
Function size_px_to_mm Converts a rectangle description in pixel to millimetres.
Function to_mm Converts a measurement of any unit to millimetres.
Function to_px Converts a measurement to amount of pixels.
Function to_str Converts a to a string.
Constant DEFAULT_PRECISION Undocumented
Constant MM_PER_IN Undocumented
Constant OGC_M_PER_PX Undocumented
Constant OGC_SCREEN_PPI Undocumented
Constant PDF_DPI Undocumented
Constant PT_PER_IN Undocumented
Variable _durations Undocumented
Variable _number Undocumented
Variable _unit_re Undocumented
MM_PER_IN: float = (source)

Undocumented

Value
25.4
PT_PER_IN: int = (source)

Undocumented

Value
72
OGC_M_PER_PX: float = (source)

Undocumented

Value
0.00028
OGC_SCREEN_PPI = (source)

Undocumented

Value
MM_PER_IN/OGC_M_PER_PX*1000
PDF_DPI: int = (source)

Undocumented

Value
96
DEFAULT_PRECISION = (source)

Undocumented

Value
{gws.Uom.deg: 7, gws.Uom.m: 2}

Undocumented

def scale_to_res(x: _number) -> float: (source)

Converts the scale to the user's resolution.

Parameters
x:_numberScale.
Returns
floatResolution in pixel.
def res_to_scale(x: _number) -> int: (source)

Converts the user's resolution to the scale.

Parameters
x:_numberResolution in pixel per inch.
Returns
intScale.
def mm_to_px(x: _number, ppi: int) -> float: (source)

Converts millimetres to pixel.

Parameters
x:_numberMillimetres.
ppi:intPixels per inch.
Returns
floatAmount of pixels.
def to_px(xu: gws.Measurement, ppi: int) -> gws.Measurement: (source)

Converts a measurement to amount of pixels.

Parameters
xu:gws.MeasurementA measurement to convert to pixels.
ppi:intPixels per inch.
Returns
gws.MeasurementA measurement.
def size_mm_to_px(xy: gws.Size, ppi: int) -> gws.Size: (source)

Converts a rectangle description in millimetres to pixels.

Parameters
xy:gws.SizeA rectangle measurements in mm.
ppi:intPixels per inch.
Returns
gws.SizeA rectangle in pixel.
def msize_to_px(xyu: gws.MSize, ppi: int) -> gws.MSize: (source)

Converts a rectangle description of any unit to pixels.

Parameters
xyu:gws.MSizeA rectangle measurements with its unit.
ppi:intPixels per inch.
Returns
gws.MSizeThe rectangle measurements in pixels.
def px_to_mm(x: _number, ppi: int) -> float: (source)

Converts pixel to millimetres.

Parameters
x:_numberAmount of pixels.
ppi:intPixel per inch.
Returns
floatAmount of millimetres.
def to_mm(xu: gws.Measurement, ppi: int) -> gws.Measurement: (source)

Converts a measurement of any unit to millimetres.

Parameters
xu:gws.MeasurementA measurement to convert.
ppi:intPixels per inch.
Returns
gws.MeasurementA measurement.
def size_px_to_mm(xy: gws.Size, ppi: int) -> gws.Size: (source)

Converts a rectangle description in pixel to millimetres.

Parameters
xy:gws.SizeA rectangle measurements in pixels.
ppi:intPixel per inch
Returns
gws.SizeThe rectangle measurements in millimetres.
def msize_to_mm(xyu: gws.MSize, ppi: int) -> gws.MSize: (source)

Converts a rectangle description of any unit to millimetres.

Parameters
xyu:gws.MSizeA rectangle measurements with its unit.
ppi:intPixels per inch.
Returns
gws.MSizeThe rectangle measurements in millimetres.
Raises
ValueErrorif the unit is invalid
def to_str(xu: gws.Measurement) -> str: (source)

Converts a to a string.

Parameters
xu:gws.MeasurementA measurement to convert.
Returns
strThe input tuple as a string, like '5mm'.
_unit_re = (source)

Undocumented

def parse(s: str|int|float, default_unit: gws.Uom = None) -> gws.Measurement: (source)

Parse a measurement in the string or numeric form.

Parameters
s:str|int|floatA measurement to parse.
default_unit:gws.UomDefault unit.
Returns
gws.MeasurementA measurement.
Raises
ValueErrorif the unit is missing, if the formatting is wrong or if the unit is invalid.
_durations = (source)

Undocumented

def parse_duration(s: str) -> int: (source)

Converts weeks, days, hours or minutes to seconds.

Parameters
s:strTime of duration.
Returns
intInput as seconds.
Raises
ValueErrorif the duration is invalid.