Thursday, May 23, 2024
rated 0 times [  2] [ 0]  / answers: 1 / hits: 735  / 3 Years ago, wed, may 26, 2021, 9:46:08

In PyGI (GTK3), how can I make a GtkEntry widget appear against the same background applied (by the user's theme) to the primary toolbar. I tried adding the same style class like this:


but that class doesn't seem to be observed on a widget that isn't a GtkToolbar. So how can I cue the user's theme to apply the same styles behind a GtkEntry widget?

(If it matters, I have the GtkEntry in the first cell of a GtkHBox container. But even when I apply a fixed gradient to that HBox the whole cell holding the GtkEntry seems to mask out the background of the HBox with a flat background colour.)


More From » application-development


It is called primary-toolbar style because it should be applied only to primary toolbar.

In Gtk, toolbars by default can hold only ToolButtons, but there is the ToolItem class, which does not have a visual represntation.

That is created because it can embed other widgets.
ToolItem has add method which you can use like :

where my_box contains your entry

Then you can add your tool item to toolbar

Your toolbar of course has called :

The reason why you cannot use "primary-toolbar" with non Toolbar widgets is most probably because in .css files it is defined like :



/* style info*/


[#36285] Friday, May 28, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.

Total Points: 72
Total Questions: 121
Total Answers: 112

Location: North Korea
Member since Mon, Oct 31, 2022
2 Years ago