KnittingPatternToSVG Module

This module provides functionality to convert knitting patterns to SVG.

class knittingpattern.convert.KnittingPatternToSVG.KnittingPatternToSVG(knittingpattern, layout, instruction_to_svg, builder, zoom)[source]

Bases: object

Converts a KnittingPattern to SVG.

This is inspired by the method object pattern, since building an SVG requires several steps.

__init__(knittingpattern, layout, instruction_to_svg, builder, zoom)[source]
Parameters:
__weakref__

list of weak references to the object (if defined)

build_SVG_dict()[source]

Go through the layout and build the SVG.

Returns:an xml dict that can be exported using a XMLDumper
Return type:dict
knittingpattern.convert.KnittingPatternToSVG.DEFINITION_HOLDER = 'g'

Inside the svg, the instructions are put into definitions. The svg tag is renamed to the tag given in DEFINITION_HOLDER.