[pygtk] drawing and modifying svg file
François Sénéquier
francois.senequier at netcourrier.com
Wed Sep 10 02:55:46 WST 2008
Hi,
I load an SVG file and I draw it on a DrawingArea :
import pygtk
pygtk.require('2.0')
import gtk
pixbuf = gtk.gdk.pixbuf_new_from_file("image.svg")
pixbuf = pixbuf.scale_simple(100,300,gtk.gdk.INTERP_BILINEAR)
image = gtk.Image()
image.set_from_pixbuf(pixbuf)
window = gtk.Window()
window.add(image)
window.connect("destroy", gtk.main_quit)
window.show_all()
But I want to do more like this :
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.
One solution ?
Thanks
More information about the pygtk
mailing list