On Tue, 18 Feb 2020 05:28:56 -0400, Mike Wey wrote:

On 17-02-2020 08:48, mark wrote:

I have this code:

optionsButton = new Button(StockID.PREFERENCES);

I am happy with the icon but instead of the text "_Preferences" I want to set "_Options".

However, when I do that the icon disappears. Is it possible to have both the stock icon and my own custom text?

You would use setImage() to set the image separately from the text.

import gtk.Image;

button.setImage(new Image(StockID.PREFERENCES));

I've just tried it like this:

        optionsButton = new Button("_Options");
	optionsButton.setImage(new Image(StockID.PREFERENCES));
        helpButton = new Button(StockID.HELP);

The help button shows an icon & the text "Help"; the options button shows a "missing icon" icon and the text "Options". Even when I use the StockID.HELP for the options button it still shows the "missing icon" icon. I'm testing this on Linux.