Interacive Python console in SVG to view/change drawing objedts

Asked by George stuart

I would like the ability to start a Python console (session) that can interace with a loaded drawing. This would help me learn how to make changes to the drawing, which I could the code into a Extension.

Question information

Language:
English Edit question
Status:
Answered
For:
Inkscape Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
sas (sas-sas) said :
#1

This isn't possible at present, since there's no Python API. (All the Python extensions just operate on SVG files.)

If you meant this to be feature request, you should file a bug report for it.

Revision history for this message
sgmanohar (sgmanohar) said :
#2

Shouldn't it be easy to implement a script editor?
E.g. just like the filters are implemented?
That would be similar and would probably fulfil your needs.

e.g.
  you could have a text box in which to type a short script,
  and a "play" button that simply passes the SVG file through the python script, and re-loads it into inkscape

Isn't that what filters do normally? It would be great to have the text editor on screen so you could do this on the fly without having to separately write scripts, save, and load them into the main inkscape filters section.

the reason I think this would be useful is that, most of the tasks I want to automate are "one-off". I.e. I only want to do it once! I don't want it appearing on a menu. I just want to type a couple of lines, and pass the file through that.

Revision history for this message
sgmanohar (sgmanohar) said :
#3

I have created an extension that provides this functionality!
You can write up to 5 lines of python script, and an Xpath selector, inside a dialog box.
see <a href="http://www.smanohar.com/inkscape.php">my inkscape extension page<a> for download.

Revision history for this message
su_v (suv-lp) said :
#4

On 2014-08-21 17:56 , sgmanohar wrote:
> I have created an extension that provides this functionality! You can
> write up to 5 lines of python script, and an Xpath selector, inside a
> dialog box. see <a href="http://www.smanohar.com/inkscape.php">my
> inkscape extension page<a> for download.

Sounds interesting - unfortunately, there's no obvious way to download the the zip archive with the extension … the link with the title "Download .zip" just points to the top-level home page ( href="http://www.smanohar.com/" ).

Revision history for this message
sgmanohar (sgmanohar) said :
#5

Whoops! link is fixed now. Sorry about that.

Revision history for this message
sgmanohar (sgmanohar) said :
#6

Whoops! forgot to put the link. Should work now.

On Thu, Aug 21, 2014 at 5:46 PM, ~suv <email address hidden>
wrote:

> Question #100981 on Inkscape changed:
> https://answers.launchpad.net/inkscape/+question/100981
>
> ~suv proposed the following answer:
> On 2014-08-21 17:56 , sgmanohar wrote:
> > I have created an extension that provides this functionality! You can
> > write up to 5 lines of python script, and an Xpath selector, inside a
> > dialog box. see <a href="http://www.smanohar.com/inkscape.php">my
> > inkscape extension page<a> for download.
>
>
> Sounds interesting - unfortunately, there's no obvious way to download the
> the zip archive with the extension … the link with the title "Download
> .zip" just points to the top-level home page ( href="
> http://www.smanohar.com/" ).
>
> --
> You received this question notification because you are a direct
> subscriber of the question.
>
>

Can you help with this problem?

Provide an answer of your own, or ask George stuart for more information if necessary.

To post a message you must log in.