'Resizing Tree in Python Tkinter

I tried making a Tree-Table in TKinter which is supposed to expand when I change the windows size. The original idea was from Tkinter, treeview doesn't resize ,from which I already copied some lines. However I need the tree to be accessible for later use, so I changed it to a variable. Does anyone know why it's not working anymore?

Heres the code, Thanks in advance!

from tkinter.ttk import Treeview

root = tk.Tk()

headlines = ["H1","H2","H3","H4","H5","H6","H7","H8"]


f1 = tk.Frame(root)
f1.grid(column=0,row=0,sticky="ns")
tree =Treeview(f1,show = ["headings"])
tree['columns'] = headlines

#naming Headlines
for i in headlines:
    tree.heading(i,text=i)
        
tree.pack(expand=True,fill='y')

root.mainloop()



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source