LengthType

class LengthType

click.ParamType sub-class to automatically converts a user-provided length string (which may contain units) into a value in CSS pixel units. This class uses convert_length() internally.

Example:

>>> import click
>>> import vpype_cli
>>> import vpype
>>> @vpype_cli.cli.command(group="my commands")
... @click.argument("x", type=vpype.LengthType())
... @click.option("-o", "--option", type=vpype.LengthType(), default="1mm")
... @vpype.generator
... def my_command(x: float, option: float):
...     pass

Methods

Attributes

name

the descriptive name of this type

Methods

Attributes

LengthType.name: str = 'length'

the descriptive name of this type