[pygtk] Saving a gdk.Pixmap bitmap

Joachim Breitner mail at joachim-breitner.de
Thu Jul 27 16:09:59 WST 2006


Hi,

I have a gdk.pixmap that is a bitmap (depth 1), and I want to save it to
disk. I tried to go by a Pixbuf, but that failed because it seemed to
need a pixmap. I tried:
   pixbuf = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB,False,8,800,600)
   pixbuf.get_from_drawable( self.bitmap,None,0,0,0,0,-1,-1)
   pixbuf.save(filename, "png", {})
whereas self.bitmap was created by:
   self.bitmap = gtk.gdk.Pixmap(None, 800, 600, 1)

If I pass gtk.gdk.colormap_get_system() as the Colormap parameter, I do
get a file, but it is monochrome empty.

Thanks for a pointer to how I can do that.

Greetings,
Joachim

-- 
Joachim "nomeata" Breitner
  mail: mail at joachim-breitner.de | ICQ# 74513189 | GPG-Key: 4743206C
  JID: joachimbreitner at amessage.de | http://www.joachim-breitner.de/
  Debian Developer: nomeata at debian.org


More information about the pygtk mailing list