Title pretty much says it all; if I make a button in GTK with a text label that has line-break(s) in it, the text on the label ends up being left aligned - and I would like it to be centered.
Longer version:
There is a set_justify() method on <label>s, which would accept "center" as a value - but the <button><label> is a <property> of the <button>, not a child. Still, looking at the result with the GTKInspector, I can clearly see that a label gets created inside the button, though I have found no way to attach a class or ID to such an implicit <label>, or to access it programmatically. For example, builder.get_object("button1").get_property("label") returns a string, and not the actual label object, so there's nothing for me to call the set_justify() method on. Furthermore, while I can call set_alignment() on the button itself, this only changes the alignment of the <label> bounding box as a whole, not the lines of text within it. I have spent hours looking for a solution and have come up short - so I have to ask for help!
Edit: As far as I have been able to determine, there is no way to achieve this with CSS alone.
Longer version:
There is a set_justify() method on <label>s, which would accept "center" as a value - but the <button><label> is a <property> of the <button>, not a child. Still, looking at the result with the GTKInspector, I can clearly see that a label gets created inside the button, though I have found no way to attach a class or ID to such an implicit <label>, or to access it programmatically. For example, builder.get_object("button1").get_property("label") returns a string, and not the actual label object, so there's nothing for me to call the set_justify() method on. Furthermore, while I can call set_alignment() on the button itself, this only changes the alignment of the <label> bounding box as a whole, not the lines of text within it. I have spent hours looking for a solution and have come up short - so I have to ask for help!
Edit: As far as I have been able to determine, there is no way to achieve this with CSS alone.