Skip to content

Instantly share code, notes, and snippets.

@rickybassom
Last active October 21, 2015 16:27
Show Gist options
  • Save rickybassom/cf37d24d6b203d3a3105 to your computer and use it in GitHub Desktop.
Save rickybassom/cf37d24d6b203d3a3105 to your computer and use it in GitHub Desktop.
Styling Gtk Windows with CSS (Python)
# https://developer.gnome.org/gtk3/3.6/GtkCssProvider.html
self.win.set_name('MyWindow')
self.button.set_name("Test")
self.style_provider = Gtk.CssProvider()
css = open('/path/to/your/style.css'), 'rb') # rb needed for python 3 support
css_data = css.read()
css.close()
self.style_provider.load_from_data(css)
Gtk.StyleContext.add_provider_for_screen(
Gdk.Screen.get_default(),
self.style_provider,
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment