1
votes

I have put together a Gtk+ interface in Glade and part of the UI is a tool palette with several toolbuttons using utf-8 characters as labels. They work fine in the default font, but I would like to change font details using pango markup. This is straightforward when dealing with a label as such, as one can apply

label.set_markup(pangoMarkupString)

but the label in a toolbutton can not, as far as I can tell, be addressed directly in this way. A naive

button.label.set_markup(pangoMarkupString)

naturally doesn't work and returns an error saying that toolbuttons do not have the label property. Is there any way to use pango parsed text in a toolbutton, and what depth of python trickery would be required at the application end?

1
You've certainly identified where I'd gone wrong. I'd chosen a mere text label, rather than a widget. Thanks for the suggestion.Tony Martin

1 Answers

1
votes

To save any others from hours of fruitless head-scratching and searching, and to open the eyes of other newbies to the powers of Gtk+ 3 and Glade, I present the solution I found.

  1. Right click on your tool palette in the outliner and select edit
  2. Choose the hierarchy tab in the editor
  3. Select your button in the hierarchy outliner
  4. Under Label properties choose widget rather than text
  5. Click on the selector icon at the right of the widget entry box
  6. Add a new widget
  7. Leave the tool palette editor
  8. Select label1, the new widget you created in the outliner
  9. You can now edit its id, label text and attributes

I don't need it yet, but I wonder how to do this with a regular button...