Pygame SVG(last modified: 10 August, '06)

A Python module for rendering an SVG image to a Pygame surface.

A module that allows you to load and display SVG images using Pygame and cairo/libsvg.
The module basically sends the SVG to cairo and receives RGBA data in return, which it then maps an SDL_Surface and then to a Pygame surface.

Usage is simple - a short example follows that will load an SVG image named 'test.svg' and display it (there are two more examples available inside the archive).

1import pygamesvg, pygame
2from pygame.locals import *
3
4svg = file("test.svg")
5# initiate pygame
6pygame.init()
7# create the pygame screen we will be drawing to
8screen = pygame.display.set_mode([500, 400])
9screen.fill((255, 255, 255))
10# render the SVG directly to the screen at the co-ordinates (0, 0), and with scale ratio (1.0, 1.0)
11pygamesvg.renderSVGFile(screen, svg, (0, 0), (0, 0), (1.0, 1.0))
12svg.close()
13# display loop
14while pygame.event.poll().type != QUIT:
15pygame.time.delay(10)
16pygame.display.update()