Top

pyagg.units module

Parses distances formatted as strings with a unit suffix, converting them to pixels. Mostly used internally.

Functions

def cm_to_px(

diststring, ppi)

def in_to_px(

diststring, ppi)

def mm_to_px(

diststring, ppi)

def parse_dist(

dist, ppi=None, default_unit=None, canvassize=None, coordsize=None)

Includes preprocessing step that makes sure the distance is formatted as a unit string before it converts it to pixels with the parse_diststring() method. Can be either nr in text, or pure nr.

def parse_diststring(

diststring, ppi=None, canvassize=None, coordsize=None)

Assuming distances are formatted as strings with a unit suffix, converts them to pixels.

def percheight_to_px(

diststring, height)

def percmax_to_px(

diststring, width, height)

def percmin_to_px(

diststring, width, height)

def percwidth_to_px(

diststring, width)

def pt_to_px(

diststring, ppi)

def px_to_px(

diststring)

def px_to_x(

columndist, width, coordwidth)

def px_to_y(

rowdist, height, coordheight)

def x_to_px(

diststring, width, coordwidth)

def y_to_px(

diststring, height, coordheight)