Hello.

I'm still struggling with displaying a PNG image on a gtk.DrawingArea. I
designed a glade interface that is basically a toplevel window with an hbox
in it. I then add() a gtk.DrawingArea in the hbox.

I'm trying to display the image this way:

    fichier = 
"/home/fab/tex/courante/TES/partie1/equations_et_inequations_du_second_degre.png"
    self.imageOriginelle = gtk.gdk.pixbuf_new_from_file(fichier)
    self.imageReduite = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, False, 8, 500, 
700)
    self.imageOriginelle.scale(self.imageReduite, 0, 0, 500, 700, 0, 0,
                               self.imageOriginelle.get_width()/500.0, 
                               self.imageOriginelle.get_height()/700.0,
                               gtk.gdk.INTERP_HYPER)

I do this because I need to rescale the image so that it fits in my
interface. The 500 and 700 values are arbitrary and for tests purposes only.

I then try to display it:

    self.GC = gtk.gdk.GC(self.zoneDeDessin.window)
    self.zoneDeDessin.window.draw_pixbuf(self.GC, self.imageReduite, 0, 0, 0, 0)

where self.zoneDeDessin is the gtk.DrawingArea object I add()ed to the hbox.

I can see a white rectangle, but no image in it. What did I miss?

Thanks!

-- 
Fabrice DELENTE
_______________________________________________
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Reply via email to