[pygtk] Drawing SVG to a gtk.DrawingArea

Marco Antonio Islas Cruz markuz at islascruz.org
Fri Nov 2 03:43:33 WST 2007


To 'display' the SVG file in a gtk.DrawingArea is quite simple. Just use
the Cairo source_pixbuf .

This code should help you to open files and 'draw' them in a
gtk.DrawingArea:

http://www.islascruz.org/html/index.php?Blog/SingleView/id/Como-dibujar-un-imagen-jpg-png-gif-etc-en-Cairo

Sorry about the fact that it is in spanish but the code is still in
pythonish.



On Thu, 2007-11-01 at 13:17 +0200, Donn wrote:
> Hi again,
> I have poked-around the net, but not found a simple example to:
> 1. Open an svg file
> 2. Draw it to a gtk.DrawingArea
> 
> I am also confused about how that would/would not fit into pycairo - is cairo 
> used to draw the svg, or is it done directly by something else?
> Is there any way to get pycairo statements from an svg? I mean, given an svg 
> file, get cairo
>         cr.set_line_width(0.1)
>         cr.set_source_rgb(0, 0, 0)
>         cr.rectangle(0.25, 0.25, 0.5, 0.5)
>         cr.stroke()
> commands out that would draw the thing.
> 
> I am aiming at paths really, closed paths that are filled.
> 
> \d
> _______________________________________________
> pygtk mailing list   pygtk at daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
-- 
<--Linux... Because I'm Free-->
Marco Antonio Islas Cruz
"Markuz"
Linux User #280229
markuz at islascruz.org
markuz at unixmexico.org
markuz at linuxpozarica.com
marco.islas at gmail.com
islacruz at yahoo.com
http://www.islascruz.org
http://sourceforge.net/projects/gpkg/
http://www.linuxpozarica.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://www.daa.com.au/pipermail/pygtk/attachments/20071101/60d79d54/attachment.pgp


More information about the pygtk mailing list