inkex.turtle module#
A Python path turtle for Inkscape extensions
- class inkex.turtle.PathTurtle(home=(0, 0))[source]#
Bases:
object
A Python path turtle
Changed in version 1.2: pTurtle has been renamed to PathTurtle.
- right(deg)[source]#
Rotate turtle right by deg degrees.
- Changed in inkex 1.2: The turtle now rotates right (previously left) when
calling this method.
- left(deg)[source]#
Rotate turtle left by deg degrees.
- Changed in inkex 1.2: The turtle now rotates left (previously right) when
calling this method.
- fd(mag: float)#
Move turtle forward by mag in the current direction.
- bk(mag)#
Move turtle backward by mag in the current direction.
- rt(deg)#
Rotate turtle right by deg degrees.
- Changed in inkex 1.2: The turtle now rotates right (previously left) when
calling this method.
- lt(deg)#
Rotate turtle left by deg degrees.
- Changed in inkex 1.2: The turtle now rotates left (previously right) when
calling this method.
- pu()#
Enable non-drawing / moving mode
- pd()#
Enable drawing mode
- inkex.turtle.pTurtle#
alias of
inkex.turtle.PathTurtle
- class inkex.turtle.PathBuilder(style: inkex.styles.Style)[source]#
Bases:
object
This helper class can be used to construct a path and insert it into a document.
New in version 1.2.
- add(command: Union[inkex.paths.interfaces.PathCommand, List[inkex.paths.interfaces.PathCommand]])[source]#
Add a Path command to the Helper
- Parameters
command (Union[PathCommand, List[PathCommand]]) – A (list of) PathCommand(s) to be appended.
- terminate()[source]#
Terminates current subpath. This method does nothing by default and is supposed to be overridden in subclasses.
- append_next(sibling_before: inkex.elements._base.BaseElement)[source]#
Insert the resulting Path as
inkex.elements._polygons.PathElement
into the document tree.- Parameters
sibling_before (BaseElement) – The element the resulting path will be appended after.
- class inkex.turtle.PathGroupBuilder(style)[source]#
Bases:
inkex.turtle.PathBuilder
This helper class can be used to construct a group of paths that all have the same style.
New in version 1.2.
- append_next(sibling_before: inkex.elements._base.BaseElement)[source]#
- Insert the resulting Path as
inkex.elements._groups.Group
into the document tree.
- Parameters
sibling_before (BaseElement) – The element the resulting group will be appended after.
- Insert the resulting Path as