How to get rid of the background gradient of the inline GtkToolbar?
Posted
by
Dima
on Ask Ubuntu
See other posts from Ask Ubuntu
or by Dima
Published on 2012-09-07T22:29:15Z
Indexed on
2012/09/12
21:50 UTC
Read the original article
Hit count: 278
When you run the below code, it will show an inline toolbar in a window. Notice how the inline toolbar has a stand-out backbround. Is there a way to apply CSS to get rid of it and make blend with regular window color?
#!/usr/bin/python3
from gi.repository import Gtk
button_names = [Gtk.STOCK_ABOUT, Gtk.STOCK_ADD, Gtk.STOCK_REMOVE, Gtk.STOCK_QUIT]
buttons = [Gtk.ToolButton.new_from_stock(name) for name in button_names]
toolbar = Gtk.Toolbar()
toolbar.set_show_arrow(False)
for button in buttons:
toolbar.insert(button, -1)
style_context = toolbar.get_style_context()
style_context.add_class(Gtk.STYLE_CLASS_INLINE_TOOLBAR)
grid = Gtk.Grid()
grid.add(toolbar)
label = Gtk.Label()
grid.add(label)
window = Gtk.Window()
window.set_size_request(200, 50)
window.add(grid)
window.connect('delete-event', Gtk.main_quit)
window.show_all()
Gtk.main()
© Ask Ubuntu or respective owner