[pygtk] Setting a stock image on a toggle button
Jono Bacon
jonobacon at gmail.com
Thu Mar 2 08:14:57 WST 2006
On 3/1/06, Stephen Langer <stephen.langer at nist.gov> wrote:
>
> 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)
I did manage to resolve this this morning. You need to specify an
empty text string when creating the toggle button ( b =
gtk.ToggleButton("") ) otherwise it triggers a GTK bug which does not
display the icon.
Jono
More information about the pygtk
mailing list