SVG library doesn't work in Python mode?

#1

I’ve tried

from processing.svg import *
which says “import * does not work in this environment.”

and

import processing.svg
which says “ImportError: No module named svg”

What am I doing wrong?

1 Like

#2

Py.Processing.org/reference/add_library.html

add_library('svg')
print PGraphicsSVG
3 Likes

#3

To add to @GoToLoop’s response –

If Processing lists the library under the Sketch > Import Library… menu, then you can select it from this menu and have the editor insert the relevant add_library() line for you.

Use import for any standard Python libraries or custom classes you have created. For example:

import datetime
print( datetime.date.today() )

from datetime import date
print( date.today() )

from Animal import Lion
...
3 Likes