[pygtk] manipulate image from a gtk.Button

awalter1 alain.walter at thalesgroup.com
Tue Nov 27 22:56:52 WST 2007


the button.set_image (newImage) has no effect !

"If you can't use the set_image method, you'll have to keep a reference to
the image you want to remove, remove it" : the initial question was how to
remove the image from a gtk.Button. and a button.remove(image) generates an
error.

Regards




Matí­as Alejandro Torres wrote:
> 
> awalter1 escribió:
>> At the creation of the button, I use :
>> image = gtk.Image()
>> image.set_from_stock (gtk.STOCK_ADD, gtk.ICON_SIZE_BUTTON)
>> button = gtk.Button()
>> button.add (image)	
>> On the 'changed' callback, I need to change the stock item to
>> STOCK_REMOVE
>> and the next time to STOCK_ADD.
>>   
> Maybe if you set the image with the set_image method,
> 
> image = gtk.Image()
> image.set_from_stock (gtk.STOCK_ADD, gtk.ICON_SIZE_BUTTON)
> button = gtk.Button()
> button.set_image (image)
> 
> And when you want to change the image,
> 
> button.set_image (newImage)
> 
> If you can't use the set_image method, you'll have to keep a reference to
> the image you want to remove, remove it, add it to the container, and hide
> and show the button.
> 
> 
> _______________________________________________
> pygtk mailing list   pygtk at daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
> 
> 

-- 
View this message in context: http://www.nabble.com/manipulate-image-from-a-gtk.Button-tf4880483.html#a13971281
Sent from the Gtk+ - Python mailing list archive at Nabble.com.



More information about the pygtk mailing list