| FAQ Index - Search - Recent Changes - Everything - Add entry |
8.10. Is it possible to use SVG icons and images in PyGTK?
Yes; PyGTK supports svg icons very well via GdkPixbuf. The following example will open a simple widgetless window and render an SVG image (from the file 'my_imagefile.svg') as its icon the top left corner:
w = gtk.Window()
pixbuf = gtk.gdk.pixbuf_new_from_file('my_imagefile.svg')
w.set_icon(pixbuf)
Apart from setting icons, you can use all functionality available to GdkPixbufs.
(Dennis Craven)
You can also do:
img = gtk.Image()
img.set_from_file('my_imagefile.svg')
