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?
Try:
image = Gtk.Image(stock=Gtk.STOCK_OPEN)
self.browse_button = Gtk.Button(label="Some Label", image=image)
See the documentation.
Like Ptomato did, but with no label and using one line :
self.btnOpen = Gtk.Button(None,image=Gtk.Image(stock=Gtk.STOCK_OPEN))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With