inkex.units module

Convert to and from various units and find the closest matching unit.

inkex.units.are_near_relative(point_a, point_b, eps=0.01)[source]

Return true if the points are near to eps

inkex.units.convert_unit(value, to_unit, default='px')[source]

Returns userunits given a string representation of units in another system

inkex.units.discover_unit(value, viewbox, default='px')[source]

Attempt to detect the unit being used based on the viewbox

inkex.units.parse_unit(value, default_unit='px', default_value=None)[source]

Takes a value such as 55.32px and returns (55.32, ‘px’) Returns default (None) if no match can be found

inkex.units.render_unit(value, unit)[source]

Checks and then renders a number with its unit