1

I'm trying to beautify my program made with Quickly using CSS. I found documentation http://developer.gnome.org/gtk3/3.4/GtkCssProvider.html and very useful blog post http://erikos.sweettimez.de/2011/11/24/gtk-3-theme-style-your-applications-2/

According to the above I should be able to use ID selectors, for example:

#nameofmywidget {
    font: Ubuntu 12;
}

Unfortunately this does not work. Only working way for me is using:

GtkEntry {
    font: Ubuntu 12;
}

or:

.entry {
    font: Ubuntu 12;
}

but it's to generic.

Apart from that I'm not able to change GtkEntry and GtkButton backgrounds. Any help much appreciated.

---------------------EDIT--------------------

I found a way to change GtkEntry and GtkButton background colours. Instead of using:

GtkEntry, GtkButton {
    background-color: #ffffff;
}

I've used:

GtkEntry, GtkButton {
    background: #ffffff;
}
1
  • Can you post the code in the widget?
    – jasmines
    Jul 3, 2012 at 13:36

3 Answers 3

1
+50

Load your .css file using that tutorial code Then on your widget do : self.sample_widget.get_style_context().add_class("sample_class")

Put this in the .css file :

GtkButton.sample_widget { color : #00FF00 }

2
  • Many thanks! It works! Although it should be GtkButton.sample_class { color : #00FF00 }
    – mivoligo
    Jul 5, 2012 at 12:22
  • Glad that I was able to help.
    – Aleksandar
    Jul 5, 2012 at 13:51
0

You can get more specfic with

GtkButton.name_of_button {
       background: red;
       }

,that way only button widget "name_of_button" will be effected.

2
  • Thanks for the answer, but it does not work for me.
    – mivoligo
    Jul 3, 2012 at 18:29
  • Wrong. That coding means "all GtkButton with class name_of_button".
    – jasmines
    Jul 4, 2012 at 5:36
0

Does

GtkButton#nameofmywidget {
    font: Ubuntu 12;
}

work? Howevere. please post your widget code too.

1
  • Thanks for answering. I tried that before but this also didn't not work. I'll try to post some code later on.
    – mivoligo
    Jul 4, 2012 at 11:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .