[pygtk] Saving a pixmap to a file

Tomeu Vizoso tomeu at sugarlabs.org
Tue Jul 21 18:18:31 WST 2009


On Tue, Jul 21, 2009 at 12:09, Xenofon Papadopoulos<xpapad at gmail.com> wrote:
> Is it possible to save a gtk.Pixmap to an image file? (i.e. a .png file)

You can create a pixbuf from that pixmap, then save it:

pixbuf = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB,
has_alpha=False, bits_per_sample=8, width=width, height=height)
pixbuf.get_from_drawable(pixmap, pixmap.get_colormap(), 0, 0,
0, 0, width, height)
pixbuf.save(...

Regards,

Tomeu

>
> _______________________________________________
> pygtk mailing list   pygtk at daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://faq.pygtk.org/
>


More information about the pygtk mailing list