[pygtk] Problems with button.

Hidura hidura at gmail.com
Wed Sep 9 03:02:39 WST 2009


I'm trying to make a button just with the icon, I want to give the relief of
the button to the icon for have more stetic in my project

On Tue, Sep 8, 2009 at 1:24 PM, John Finlay <finlay at moeraki.com> wrote:

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



-- 
Hidura
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20090908/9ab65163/attachment.htm 


More information about the pygtk mailing list