Skip to content

How to have a Gtk.Button with Icon and Label #1140

Discussion options

You must be logged in to vote

The Gtk.Button will display either a Label or an Icon but not both at the same time. If you want to have both a icon and a label on a button then you need to make a Gtk.Box a child of the Gtk.Button and add the Gtk.Image and Gtk.Label to the Gtk.Box.

Example of a Quit Button with an Icon and a Label:

var quitButton = Gtk.Button.New();
var quitBox = Gtk.Box.New(Gtk.Orientation.Horizontal, 10);
// Creates a label that you can use Alt+Q to act the same as clicking the button
var quitLabel = Gtk.Label.NewWithMnemonic("_Quit");
// Icon Names come from https://specifications.freedesktop.org/icon-naming-spec/latest/
// The theme needs to have the icon Gtk Apps by default use the Adwaita theme
va…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@badcel
Comment options

@anthonyirwin82
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by anthonyirwin82
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants