psychos.visual.units.PTUnit#
- class psychos.visual.units.PTUnit(window: Window)[source]#
Bases:
UnitPoints (pt) unit system.
1pt corresponds to a specific number of pixels based on the screen’s DPI.
This unit is useful for typographic elements or for aligning designs with text-based layouts.
Methods
__init__(window)from_name(name, window)Instantiate a unit system class by name or return the instance if already provided.
inverse_transform(x, y)Convert coordinates from pixel values to units.
inverse_transform_size(width, height)Convert size from pixel values to units.
transform(x, y)Convert coordinates from units to pixel values.
transform_size(width, height)Convert size from units to pixel values.
Attributes
Calculate pixels per point based on the current screen DPI.
- inverse_transform(x: int, y: int) Tuple[float, float][source]#
Convert coordinates from pixel values to units.
- inverse_transform_size(width: int, height: int) Tuple[float, float][source]#
Convert size from pixel values to units.