On Mon, May 13, 2002 at 10:59:25PM +0200, Thomas Guettler wrote:
> Hi!
> 
> I am new to pygtk, how can I display a jpg file?
> 
> BTW, I tried to read the FAQ, but async.com.br is unavailable.

The FAQ is available again, I found the answer how to display a jpeg. 

Maybe the FAQ should contain how to scale an image, too. I do like this:

#start
                img=GdkImlib.Image("foo.jpg")
                size=600
                width=img.rgb_width
                height=img.rgb_height
                print width, height
                if width>height:
                        height=(size*height)/width
                        width=size
                else:
                        width=(size*width)/height
                        height=size
                print width, height
                img.render(width, height)
                pixmap=img.make_pixmap()
                self.vbox.pack_start(pixmap, gtk.TRUE, gtk.TRUE, 0)
                pixmap.show()
#end

Is this the right way?

 thomas

-- 
Thomas Guettler <[EMAIL PROTECTED]>
http://www.thomas-guettler.de

_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to