Python - gtk3 add stock icons to Gtk.Buttons

gtk3, icons, python

Solution

Try:

image = Gtk.Image(stock=Gtk.STOCK_OPEN)
self.browse_button = Gtk.Button(label="Some Label", image=image)

See the documentation.

Problem

I'm new to GTK3 (I prefer `wxWidgets`), and I can't load a stock icon to a gtk.button... This is my attempt: ``` image = Gtk.Image() pb = Pixbuf.new_from_stock(Gtk.STOCK_OPEN) self.browse_button = Gtk.Button(label="") self.browse_button.set_from_pixbuf(pb) ``` This is how it is done on `wxWidgets` (much more simpler): ``` self.browse_button = wx.BitmapButton( self, wx.ID_ANY, wx.ArtProvider.GetBitmap( wx.ART_FILE_OPEN, wx.ART_MENU ), wx.DefaultPosition, wx.DefaultSize, wx.BU_AUTODRAW ) ``` any help?

Original source