SVG library doesn't work in Python mode?

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

Py.Processing.org/reference/add_library.html

add_library('svg')
print PGraphicsSVG
3 Likes

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

add_library(‘svg’) works when I run it in the processing IDE, but I’m using Visual Studio now and when I run the same exact code from the terminal using “java -jar processing-py.jar star_generator_2.py” I get “Exception: This sketch requires the “svg” library. at 10:0 in star_generator_2.py”.

I’ve tried using “from processing import svg” as well without luck. How do I get this working in my IDE?