I'm trying to write the function where the browse button will browse the file and will print its location in the label. However, getting error : AttributeError: 'NoneType' object has no attribute 'pack'. How can this error be resolved and print the location in a label? any help would be appriciated.
from tkinter import *
from tkinter import ttk
from tkinter import filedialog
root = Tk()
root.geometry('700x650')
def file_opener():
input = filedialog.askopenfile(initialdir="/")
print(input)
for i in input:
print(i)
label_1 = Label(root, text="Location",width=20,font=("bold", 10))
label_1.place(x=65,y=130)
x = Button(root, text='Browse',command="file_opener",width=6,bg='gray',fg='white').place(x=575,y=130)
x.pack()
entry_1 = Entry(root)
entry_1.place(x=240,y=130,height=20, width=300)
root.mainloop()