[pygtk] Aligning Image in Buttons

Xenofon Papadopoulos xpapad at gmail.com
Fri Jul 24 17:03:06 WST 2009

I'm displaying an image in a button, like this:

        def set_button_icon( self, btn, fname, width = 40, height = 40 ):
                pb = gtk.gdk.pixbuf_new_from_file( fname )
                pb = pb.scale_simple( width, height, gtk.gdk.INTERP_BILINEAR
                img = gtk.Image()
                img.set_from_pixbuf( pb )
                btn.set_label( '' )
                btn.set_image( img )

where btn is a gtk.Button
However the image is drawn beginning from the top left corner of the button.
How can I align it to the center?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20090724/c994a02a/attachment.htm 

More information about the pygtk mailing list