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 usesconvert_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
Methods¶
Attributes¶
-
LengthType.
__doc__
= ':class:`click.ParamType` sub-class to automatically converts a user-provided length\n string (which may contain units) into a value in CSS pixel units. This class uses\n :func:`convert_length` internally.\n\n Example::\n\n >>> import click\n >>> import vpype_cli\n >>> import vpype\n >>> @vpype_cli.cli.command(group="my commands")\n ... @click.argument("x", type=vpype.LengthType())\n ... @click.option("-o", "--option", type=vpype.LengthType(), default="1mm")\n ... @vpype.generator\n ... def my_command(x: float, option: float):\n ... pass\n '¶
-
LengthType.
__module__
= 'vpype.utils'¶
-
LengthType.
name
= 'length'¶