How to change ttk.Treeview column width and weight in Python 3.3
python, python-3.x, tkinter
Solution
`Treeview.Column` does not have `weight` option, but you can set `stretch` option to `False` to prevent column resizing.
from tkinter import *
from tkinter.ttk import *
root = Tk()
tree = Treeview(root, selectmode="extended", columns=("A", "B"))
tree.pack(expand=YES, fill=BOTH)
tree.heading("#0", text="C/C++ compiler")
tree.column("#0", minwidth=0, width=100, stretch=NO)
tree.heading("A", text="A")
tree.column("A", minwidth=0, width=200, stretch=NO)
tree.heading("B", text="B")
tree.column("B", minwidth=0, width=300)
root.mainloop()
Problem
I have created a GUI for my application with Tkinter. I am using also a treeview widget. However I am unable to change its column widths and weights. How to do it properly? Sample: ``` tree = Treeview(frames[-1],selectmode="extended",columns=("A","B")) tree.heading("#0", text="C/C++ compiler") tree.column("#0",minwidth=0,width=100) tree.heading("A", text="A") tree.column("A",minwidth=0,width=200) tree.heading("B", text="B") tree.column("B",minwidth=0,width=300) ``` As far as I understand it should create three columns with widths: 100,200 and 300. However nothing like that happens.