Updated British English translation
[tbo.git] / test / rsvgtest.py
1 # -*- coding: utf-8 -*-
2 import cairo, gtk, rsvg, sys
3
4 class myApp:
5     def __init__(self, filename):
6         mw = gtk.Window(gtk.WINDOW_TOPLEVEL)
7         mw.connect("delete_event", gtk.main_quit)
8
9         svg = rsvg.Handle(filename)
10
11         da = gtk.DrawingArea()
12         da.set_size_request(svg.props.width, svg.props.height)
13         da.connect("expose_event", self.expose, svg)
14
15         mw.add(da)
16         mw.show_all()
17
18
19     def expose(self, da, event, svg):
20         ctx = da.window.cairo_create()
21         svg.render_cairo(ctx)
22
23
24 if __name__ == "__main__":
25     if len(sys.argv) != 2:
26         print "Uso: %s fichero.svg" % sys.argv[0]
27     else:
28         try:
29             app = myApp(sys.argv[1])
30             gtk.main()
31         except KeyboardInterrupt:
32             pass
33