-1

I have a layout where the main item is a ttk.Treeview, so I would like for it to fill the available space. It does so horizontally, but not vertically. Here is the code for the relevant frame:

f_right = Frame(f_main, relief=RELIEF, borderwidth=BWIDTH, padding=PADDING)
f_right.grid(column=2, row=0, sticky = E+N+S)

entry = tk.Entry(f_right)
entry.grid(column=0, row=0, sticky = N)

Style(root_window).configure("Treeview",rowheight=FONT_HEIGHT,background="black",
    foreground="white",fieldbackground="black")

tree = ttk.Treeview(f_right, style = "Treeview")
tree.grid(column=0, row=1, sticky = W+E+N+S)

The frame f_right fills vertically, so there is plenty of space for the tree to grow.

Since everything else is laid out using grid(), I cannot use pack().

Is there anything I can do to make the Treeview use up the vertical space?

Betta George
  • 121
  • 5
  • 1
    Read [what-does-weight-do-in-tkinter](https://stackoverflow.com/questions/45847313) – stovfl Jun 12 '20 at 21:26
  • @stovfl Well I have egg on my face. Thank you so much! I find the documentation for this module hard to use at times. I'm gonna reply to my own question since your comment immediately solved the problem. – Betta George Jun 12 '20 at 21:37

1 Answers1

0

Well, thanks to @stovl I found out that it has nothing to do with the Treeview, but I simply neglected to read the tkinter documentation carefully enough. You have to set a nonzero weight to the row to make it expand.

What does 'weight' do in tkinter?

Betta George
  • 121
  • 5