Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python GTK3 Treeview buttons

Tags:

python

ubuntu

gtk

With GTK3 some Treeviews (I presume) have a few buttons at the bottom that appear to be part of it. The System Settings in Ubuntu uses this, as well as the File Selector dialog for GTK3 apps

Example treeview

Is this a part of GTK3 or just a specially made container?

like image 367
UbunTom Avatar asked Mar 24 '12 21:03

UbunTom


1 Answers

In case anyone else comes here, the buttons are ToolButtons in a Toolbar with the "inline-toolbar" class

self.listTools=Gtk.Toolbar()
self.listTools.set_property("icon_size",1)
context=self.listTools.get_style_context()
context.add_class("inline-toolbar")

self.addButton=Gtk.ToolButton()
self.addButton.set_property("visible",True)
self.addButton.set_property("can_focus",False)
self.addButton.set_property("use_action_appearance",False)
self.addButton.set_property("use_underline",False)
self.addButton.set_property("icon_name","list-add-symbolic")
self.listTools.add(self.addButton)

I'm not sure if all the button specific properties are necessary

I packed the treeview above the toolbar an a ScrolledWindow and gave it these properties

scrolled_window = Gtk.ScrolledWindow()
scrolled_window.add_with_viewport(self.objectsView)
scrolled_window.set_property("shadow_type","in")

Then finally I packed the ScrolledWindow above the Toolbar in a VBox

like image 78
UbunTom Avatar answered Oct 01 '22 05:10

UbunTom