pythagoras.backend module

pythagoras.backend.fill_default_args(args: Iterable[POProperty], *defaults: tuple[type, POProperty]) list[POProperty][source]

Complete a list of POProperty’s with default values for the types that are missing.

Parameters:
  • args – Initial set of properties.

  • defaults – List of types with their default values.

Returns:

The completion of args.

pythagoras.backend.svg_command(name: str, *args: POProperty) str[source]

Put together an SVG command from its components.

Parameters:
  • name – Name of the command, that is, <{name}>.

  • *args – Parameters of the command, which correspond to key-value pairs when compiled, but are given as POProperty’s.

Returns:

A valid SVG command.

pythagoras.backend.svg_path(points: Iterable[tuple[float, float]], *args: POProperty) str[source]

Construct an SVG path from its points.

Parameters:

points – The sequence of points (in the SVG coordinate system) that make up the path.

Returns:

Final <path d="..."> tag.

pythagoras.backend.tikz_command(name: str, body: str, *args: POProperty) str[source]

Put together a TikZ command from its components.

Parameters:
  • name – Name of the command, that is, \{name}.

  • body – What goes between the command arguments and the final semicolon.

  • *args – Arguments of the command – i.e., \{name}[args] – as POProperty’s.

Returns:

A valid TikZ command.