How to change ttk.Treeview column width and weight in Python 3.3 -
i have created gui application tkinter. using treeview widget. unable change column widths , weights. how 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 understand should create 3 columns widths: 100,200 , 300. nothing happens.
treeview.column
not have weight
option, can set stretch
option false
prevent column resizing.
from tkinter import * 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()
Comments
Post a Comment