Pycairo is set of Python bindings for the cairo graphics library.
About Cairo:
Cairo is a software library used to provide a vector graphics�based, device-independent API for software developers. It is designed to provide primitives for 2-dimensional drawing across a number of different backends. Cairo is designed to use hardware acceleration when available.
Although written in C, there are bindings for using the cairo graphics library from many other programming languages, including Haskell, Java, Perl, Scheme, Smalltalk and several others. Dual licensed under the GNU Lesser General Public License and the Mozilla Public License, cairo is free software.
This simple example draws a blue triangle into a png file.
#!/usr/bin/env python
import cairo
WIDTH, HEIGHT = 400, 400
# Setup Cairo
surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, WIDTH, HEIGHT)
ctx = cairo.Context(surface)
# Set thickness of brush
ctx.set_line_width(15)
# Draw out the triangle using absolute coordinates
ctx.move_to(200, 100)
ctx.line_to(300, 300)
ctx.rel_line_to(-200, 0)
ctx.close_path()
# Apply the ink
ctx.stroke()
# Output a PNG file
surface.write_to_png("triangle.png")
Product's homepage