I'm writting a little application with Python and Gtk3. Almost everything runs ok but one thing : I can't change my button font size using CSS. I can change font family (arial, ...) colors, background-colors but the font size seems to be ignored. Do you have any tip ?
Here is my code:
from gi.repository import Gtk, Gdk
class Monelio:
def __init__(self):
# load CSS
style_provider = Gtk.CssProvider()
css = open('monelio.css')
css_data = css.read()
css.close()
style_provider.load_from_data(css_data)
Gtk.StyleContext.add_provider_for_screen(
Gdk.Screen.get_default(),
style_provider,
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
)
# load CSS
style_provider = Gtk.CssProvider()
css = open('monelio.css')
css_data = css.read()
css.close()
style_provider.load_from_data(css_data)
Gtk.StyleContext.add_provider_for_screen(
Gdk.Screen.get_default(),
style_provider,
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
)
button1 = Gtk.Button()
button1.set_label(" - ")
button1.set_name("btn_moins_" + str(x+1))
button1.set_size_request(80, 70)
button1.get_style_context().add_class("btn_moins")
button1.connect("clicked", self.on_btn_moins_clicked)
button1.show()
and my css:
.btn_moins {
background-color: orange;
background: orange;
color: white;
font-weight: bold;
font-size: 25;
padding: 0 20px 0 20px;
}