#!/usr/bin/env python3 import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk class Slider(Gtk.Scale): def __init__(self, width = 256, height = 5): Gtk.Scale.__init__(self) self.set_name('Slider') self.set_range(0, 100) self.set_size_request(width, height) self.set_draw_value(False) css_provider = Gtk.CssProvider() style = f""" #Slider {{ outline: none; }} #Slider trough {{ background-color: rgba(129, 161, 193, 0.35); outline: none; }} #Slider trough highlight {{ background-color: rgba(163, 190, 140, 0.75); }} #Slider slider {{ background-color: transparent; border-color: transparent; outline: none; }} """ css_provider.load_from_data(style.encode('UTF-8')) context = self.get_style_context() context.add_provider(css_provider, Gtk.STYLE_PROVIDER_PRIORITY_USER)