def add_widget_custom_css(widget, style):
priority = Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
provider = Gtk.CssProvider()
context = widget.get_style_context()
filename = relative_path(style)
if os.path.exists(filename):
provider.load_from_path(filename)
else:
provider.load_from_data(style.encode())
context.add_provider(provider, priority)
评论列表
文章目录