Loading and modifying svg within Inkscape plugin
I am currently writing an Inkscape plugin using Python. Within this plugin, I would like to load a template (an existing svg) from the plugin folder and access some objects within this template by name or key. Then I would like to change the border and/or fill color of the object and add some text to it. How would I do this using the python scripting interface of inkscape? I found just a few examples (see below) on how to write a plugin for inkscape, but they all work on existing, already opened documents.
Can you use lxml?
t = etree.parse("path/test.xml")
You could then either
t
directly -- this can be done from python without actually opening inkscape. Your tree could be saved with t.write("filename")
t
to the currently open document using self.document.getroot().append(t)
Also, this is not what you asked for, but may come in useful: an inkscape plugin that allows you to write short python snippets from within Inkscape: http://www.smanohar.com/inkscape.php
链接地址: http://www.djcxy.com/p/56946.html上一篇: 将inkscape svg转换为raphael问题
下一篇: 在Inkscape插件中加载和修改svg