2012-03-24 42 views
7

對於GTK3,一些TreeView(我推測)在底部有幾個按鈕,它們似乎是其中的一部分。在Ubuntu系統設置使用此,以及爲GTK3文件選擇對話框中的應用程式Python GTK3 Treeview按鈕

Example treeview

這是GTK3的一部分,或者只是一個特製的容器?

+0

可能重複[Mac風格加入按鈕(分段控制)與Gtk](http://stackoverflow.com/questions/8277152/mac-style-joined-buttons-segmented-control-with-gtk) – ptomato 2012-03-28 15:09:21

+0

這已經被問了幾次了,下面是另一個:http://stackoverflow.com/questions/8617788/how-to-change-the-style-for-buttons-in-gtk – ptomato 2012-03-28 15:09:51

回答

7

如果任何人來到這裏,該按鈕在工具欄按鈕的位置與「直列工具欄中的」類

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) 

我不知道如果所有的按鈕,特定的屬性是必要的

我收拾好工具欄的一個ScrolledWindow上述樹形視圖,然後交給了​​這些屬性

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

於是最後我收拾了ScrolledWindow工具欄上方VBox

0

添加/刪除/上/下按鈕是TreeView的單獨控件。您必須將它們添加到您的用戶界面並自行實施這些行爲。

相關問題