Skip to content

Document and give example of intermix of SimpInkScr and inkex #113

Description

@robertlugg

When I was looking into using the package I was worried that it was an either/or proposition to use traditional Extension programming or to use SimpInkScr. It would be nice to document the ability briefly. An example would also help to demonstrate. I don't know exactly how this should look but I was thinking of something like:

# Draw left circle using Simple Inkscape Scripting interface
style = {'stroke': '#000000', 'stroke-width': 1, 'fill': '#FF0000'}
circle((0, canvas.height/2), canvas.width/4, **style)

# Draw right circle using the inkex lower-level interface
style = {'stroke': '#000000', 'stroke-width': 1, 'fill': '#0000FF'}
parent =  extension.svg.get_current_layer ()
circle_attribs = {'style': str(inkex.Style(style)),
                    inkex.addNS('label', 'inkscape'): "mycircle",
                    'cx': str(canvas.width), 'cy': str(canvas.height/2),
                    'r': str(canvas.width/4)}
parent.add(inkex.Circle(**circle_attribs))

Code like this can be pasted directly into the "Python Code" dialog to demonstrate the two libraries working seamlessly together. I'm happy to make the changes but am not confidant that my code example is correct and best :)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions