NodeBox

Create visual output with Python programming code
Home Download Reference Tutorial Library Gallery About

svg.parse()

Syntax

parse(str)

Description

Returns a list of paths that are drawable with the drawpath() command. Each returned path has a few special properties not present in normal paths:

These can be used to copy color information from the original vector drawing. Read the tutorial on paths to see what you can do with the points of a path.

Example

svg = ximport("svg")
data = open("flower.svg").read()
paths = svg.parse(data)

for path in paths:
  try:
    fill(path.fill)
  except:
    fill(random(), 0, 0)
  drawpath(path)