Something
public text v1 · immutable#!/usr/bin/python
from mod_python import apache
import cairo
import cStringIO
WIDTH, HEIGHT = 400, 300
def handler (req):
# generate a png with cairo
surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, WIDTH, HEIGHT)
ctx = cairo.Context(surface)
ctx.move_to (200,100)
ctx.line_to (200,200)
ctx.stroke ()
req.content_type = "image/png"
surface.write_to_png(req)
return apache.OK