2015-02-06 41 views
3

我在Python建立了一個非常基本的Treeview如何在Treeview小部件中禁用列大小調整?

self.tv = ttk.Treeview(top_frame, columns=("#","ID","Name"), selectmode = "browse") 

self.tv.heading('#1', text='#', anchor=W) 
self.tv.heading('#2', text='ID', anchor=W) 
self.tv.heading('#3', text='Name', anchor=W) 

self.tv.column('#1',minwidth=70, width = 70, stretch=NO) 
self.tv.column('#2', minwidth = 240, width = 240, stretch=NO) 
self.tv.column('#3', minwidth=260, width = 260, stretch=NO) 
self.tv.column('#0', minwidth=0, width=0, stretch=NO) 

我的問題是,列可以被調整到使樹視圖或者比其更廣泛的容器,或者更窄。這兩者都破壞了整個事物的美學。

從我讀到的stretch = NO應該禁用這個,但它不是。我正在用Python 2.7.9在Mac上測試GUI。我知道某些小工具只是在Mac上無法100%工作,所以我做錯了什麼,或者是我所期望的?

+1

(對於未來的讀者)有可能趕上並阻斷''事件,當它結束了一個TreeView分隔爲我勾勒出[這個答案](https://stackoverflow.com/a/46120502/736937 )到一個明顯重複的問題。 – jedwards 2017-09-08 16:05:27

回答

相關問題