Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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;
}
share|improve this question
    
Can you post the code in the widget? –  jasmines Jul 3 '12 at 13:36

3 Answers 3

up vote 1 down vote accepted
+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 }

share|improve this answer
    
Many thanks! It works! Although it should be GtkButton.sample_class { color : #00FF00 } –  mivoligo Jul 5 '12 at 12:22
    
Glad that I was able to help. –  Aleksandar Jul 5 '12 at 13:51

You can get more specfic with

GtkButton.name_of_button {
       background: red;
       }

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

share|improve this answer
    
Thanks for the answer, but it does not work for me. –  mivoligo Jul 3 '12 at 18:29
    
Wrong. That coding means "all GtkButton with class name_of_button". –  jasmines Jul 4 '12 at 5:36

Does

GtkButton#nameofmywidget {
    font: Ubuntu 12;
}

work? Howevere. please post your widget code too.

share|improve this answer
    
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 '12 at 11:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.