On 2008-09-09, Fran?ois Sénéquier <[EMAIL PROTECTED]> wrote:
>
> I would load and SVG file (XML file so a text file), modify it
> (changing a color, moving a part...) by the DOM/XML interface (or
> directly adding or replacing text) and create again an gtk.gdk.pixbuf
> without creating another SVG file. 
>
> So the solution could be to load the text file, modify it and create a
> new pixbuf from the loaded modified text (not the file)... 
>
> But with the gtk.gdk.pixbuf it is possible to create a pixbuf from a
> file but it seems to be impossible to create a pixbuf from a SVG
> string variable ?
>
> I don't want to create several svg files but modifying dynamically the
> content of an unique svg file (after loaded it) and then draw it.
>

Use PixbufLoader('svg')

def svg_str_to_pixbuf(txt):
    '''Load pixbuf from a svg str.'''
    pl = gtk.gdk.PixbufLoader('svg')
    pl.write(txt)
    pl.close()
    pix = pl.get_pixbuf()
    return pix

_______________________________________________
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to