Kustekjé Meklootn
Kustekjé Meklootn

Reputation: 1328

Tkinter Treeview shows only first 3 columns

On startup of the program; Tkinter Treeview shows only the first 3 columns of 5. When you alter with the mousepointer in the heading the width of a random column by a small amount(few pixels), all columns comes in sight after releasing the mouse button.

update: option displaycolumns="#all" gives the same result.

hcolumns=('Hoofdstuk','Naam','Datum','Grootte','tafel')
tv=ttk.Treeview(mainframe, columns=hcolumns , show='headings', height=5)
for col in hcolumns:
    tv.heading(col, text=col, command=lambda _col=col: treeview_sort_column(tv, _col, False))
tv.grid(column=0, row=0, sticky=(N,W,E,S))

Before altering width with mousepointer enter image description here

After altering width with mousepointer: enter image description here

Upvotes: 0

Views: 303

Answers (1)

Kustekjé Meklootn
Kustekjé Meklootn

Reputation: 1328

Adding width=<random number> as column-option did the trick. So you get this:

for col in hcolumns:
    tv.heading(col, text=col, command=lambda _col=col: treeview_sort_column(tv, _col, False))
    tv.column(col, width=0)

Upvotes: 2

Related Questions