Search code examples
python-3.xgtk3glade

Python3, Gtk3, Glade, set label color from code


I have a Glade file with a label with a gray default color, which I want to override with green from code.

Therefore I added a style class in Glade:

glade part

and added this to my Python script:

python part

However, the color remains gray.

What did I do wrong?


Solution

  • The problem was, that Glade initially preceded the style class name with a dot in its generated XML file (see screenshot in the OP).

    You need to edit the Glade XML file and remove it:

    enter image description here

    After that, you can repeatedly change the style class name in the Glade GUI, it does not get a dot again.