Inkscape.org
Creating New Extensions Load svg fom new extension
  1. #1
    urbanspaceman urbanspaceman @urbanspaceman

    Hi, i''m coding a new extension (and i'm learning step by step?
    Now i have this structure

    extensions
    myextension.inx
    -- myextension
    --- myextension.py
    --- svg
    ---- flower.svg
    ---- elephant.svg


    in the UI of my extension i have an enum select and i want to insert, in the document, one of this svg files according to my selection

    Thanks

  2. #2
    Maren Hachmann Maren Hachmann @Moini

    I seem to remember that lxml can read files directly and parse the DOM...

    Ah, here:

    https://lxml.de/parsing.html

    I'm not sure how to reliably find the file on all operating systems, though, you'd need to try that out. Maybe also the inkex api provides a way to get the path to the script now...?

    Check here to find out: https://inkscape.gitlab.io/extensions/documentation/

    (this is the API for the upcoming 1.0)

  3. #3
    urbanspaceman urbanspaceman @urbanspaceman

    Thanks Maren