Search code examples
htmlsvgbrython

Brython: how to include svg image?


I am trying to include and already existing svg image at a given position on the small webpage that I am designing, and since I am a total javascript noob I decided to use Brython. I thought the following command

triangle = svg.image(src="eight_rest.svg", x = 500, y = 50, height = 100)
document['graphics_zone2'] <= triangle

would work, but it doesn't. There are not infos on the different svg functions on the brython doc other than the examples so I don't know what I am doing wrong. Has someone already tried this?


Solution

  • Don't know if you already solved this, but the "src" in your code should be "href". The following works for me.

    triangle = svg.image(href="eight_rest.svg", x = 500, y = 50, height = 100)
    document['graphics_zone2'] <= triangle