[pygtk] Problems with button.
John Finlay
finlay at moeraki.com
Wed Sep 9 01:24:39 WST 2009
Hidura wrote:
> Hello, List i have this sub-class of a Button and make me the icon
> what i pass in the button but lose the releif when the icon replace
> the button how could i change that and give the relief back again.
>
>
> Thanks.
>
>
> ##CODE
> class Button(gtk.Button):
> """
> This is the constructor of the Vertical Scale.
> """
>
> def __init__(self):
> gtk.Button.__init__(self)
> self.gc = None # initialized in realize-event handler
> self.width = 0 # updated in size-allocate handler
> self.height = 0 # idem
> self.connect('size-allocate', self.on_size_allocate)
> self.icon =
> '/usr/local/lib/python2.5/HidalgoP/.Logos/Buttons/add.png'
>
>
>
>
> def do_expose_event(self, event):
>
> self.window.draw_pixbuf(self.gc,
> gtk.gdk.pixbuf_new_from_file_at_size(self.icon, 60, 60),
> 0, 0, -1, -1, -1, -1, gtk.gdk.RGB_DITHER_NORMAL, 0, 0)
> self.set_relief(gtk.RELIEF_NORMAL)
>
>
> def on_size_allocate(self, widget, allocation):
> self.width = allocation.width
> self.height = allocation.height
>
>
Are you trying to put the Pixbuf inside the Button or undeneath the
button? I'm having trouble understanding what you are trying to do.
John
More information about the pygtk
mailing list