[pygtk] Setting a stock image on a toggle button

Stephen Langer stephen.langer at nist.gov
Thu Mar 2 06:08:07 WST 2006


On Mar 1, 2006, at 5:23 AM, Jono Bacon wrote:

> I have been digging around trying to find this out, but I am getting
> no-where. How do I add a stock icon to a toggle button - just the icon
> and no text?

I think this is what you want...

button = gtk.ToggleButton()
image = gtk.Image()
image.set_from_stock(gtk.STOCK_STOP, gtk.ICON_SIZE_BUTTON)
button.add(image)

  -- Steve

--
-- EMail: stephen.langer at nist.gov                    Phone: (301)  
975-5423 --
-- WWW:  http://math.nist.gov/mcsd/Staff/SLanger/    Fax:   (301)  
975-3144 --
-- Mail: NIST; 100 Bureau Drive -- Stop 8910; Gaithersburg, Md   
20899-8910 --

-- "I don't think this will work.  That's why it's  
science."               --
--                                      Naomi Langer,  17 Feb  
2003         --




More information about the pygtk mailing list