Monday, April 29, 2024
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 1362  / 1 Year ago, fri, january 27, 2023, 10:09:47

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;
}

More From » application-development

 Answers
4

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
}


[#37171] Saturday, January 28, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ithriv

Total Points: 46
Total Questions: 115
Total Answers: 96

Location: Malaysia
Member since Wed, May 11, 2022
2 Years ago
;