[pygtk] Aligning Image in Buttons

Bertrand Son Kintanar b3rxkintanar at gmail.com
Sat Jul 25 09:56:29 WST 2009


On Fri, Jul 24, 2009 at 5:03 PM, Xenofon Papadopoulos <xpapad at gmail.com>wrote:

> 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?
> Thanks


maybe
http://library.gnome.org/devel/pygtk/stable/class-gtkbutton.html#method-gtkbutton--set-alignmentwill
help

-- 
b3rx

"Don't be trapped by dogma - which is living with the results of other
people's thinking. - Steve Jobs"

`There are only 10 types of people in the world — those who understand
binary, and those who don't.'
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20090725/3aab8969/attachment.htm 


More information about the pygtk mailing list