How can I make GtkBtton round in shape?
The accepted answer said:
There is no roundness option in the base set.
Well, there is now! See the GTKWidget
documentation:
In special cases, buttons can be made round by adding the .circular style class.
So, for example:
gtk_style_context_add_class (gtk_widget_get_style_context (button),
"circular");
This works using both of the standard themes, Adwaita and HighContrast.
In GTK4, there are convenience functions to avoid having to get the StyleContext
yourself:
gtk_widget_add_css_class (button, "circular");
The above assumebutton
is a GtkWidget*
. If, instead, it's a GtkButton*
or subclass, just substitute in GTK_WIDGET (button)
of course.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With