'Text-align and GTK CSS
This is interesting, according to the docs there isn't a text-align and trying it gives
gi.repository.GLib.Error: gtk-css-provider-error-quark: <data>:3:14'text-align' is not a valid property name (3)
Is there an alternative to text-align: left/right/etc for buttons or other widgets with GTK CSS?
Solution 1:[1]
I should have updated with answer -
self.builder.get_object("button1").set_alignment(0,0);
Solution 2:[2]
You might try the "gtk_widget_set_halign" function. Following is an example.
gtk_widget_set_halign(GTK_WIDGET(button), GTK_ALIGN_CENTER);
The first parameter is the widget that you want to affect (e.g. a button). The second parameter is the type of alignment that you want to perform within the widget. The second parameter has five pre-defined constants:
GTK_ALIGN_BASELINE
GTK_ALIGN_CENTER
GTK_ALIGN_END
GTK_ALIGN_FILL
GTK_ALIGN_START
I hope that is clear.
Regards.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | NoBugs |
Solution 2 | NoDakker |