I have an SVG graphic represented in a string
svg_string='<svg height="100" width="500"><ellipse cx="240" cy="50" rx="220" ry="30" style="fill:yellow" /><ellipse cx="220" cy="50" rx="190" ry="20" style="fill:white" /></svg>'
I want to display the graphics represented by svg_string, which is 2 ellipses, on a window initiated from Python.
The pseudo code of which should be something like
import pygame
def display_svg_figure(screen, svg_string):
# Code that draws the rendered SVG string on
# the screen
pass
background_colour = (255, 255, 255)
(width, height) = (900, 900)
screen = pygame.display.set_mode((width, height))
pygame.display.set_caption('Display SVG')
screen.fill(background_colour)
pygame.display.flip()
svg_string='<svg height="100" width="500"><ellipse cx="240" cy="50" rx="220" ry="30" style="fill:yellow" /><ellipse cx="220" cy="50" rx="190" ry="20" style="fill:white" /></svg>'
display_svg_figure(screen, svg_string)
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
I am basically looking at an implementation of the method display_svg_figure(screen,svg_string)
I am open to a using non pygame libraries too as long as it follows the simple interfaces of the following and is possible to include it in pygame
from SOME_LIBRARY import SOME_COMPONENT
svg_string="......"
SOME_COMPONENT.display(svg_string)
I have already looked at pynanosvg but that's no longer supported and is failing so does not suffice my need.
The solution given in Display SVG file in Python does not seem to fit the bill as it is not working in PyGame. If someone can make it work kindly let me know.

