[pygtk] create a gtk.Button without any label

Tim Evans t.evans at aranz.com
Tue Nov 27 12:35:10 WST 2007


awalter1 wrote:
> Hi,
> 
> I'm looking about how to create a button with only a stock item and no
> label.
> 
> The unique solution I've found is :
> button = gtk.Button(stock=gtk.STOCK_SAVE)  			
> alignment = button.get_children()[0]
> hboxtemp = alignment.get_children()[0]
> image, text = hboxtemp.get_children()
> text.set_text(' ')
> 
> 
> Is there a more simple solution ?

image = gtk.Image()
image.set_from_stock(gtk.STOCK_SAVE, gtk.ICON_SIZE_BUTTON)
button = gtk.Button()
button.add(image)
image.show()

I would consider this to be the correct way to do it.

-- 
Tim Evans
Applied Research Associates NZ
http://www.aranz.com/


More information about the pygtk mailing list