Currently trying to work with GUI's and i am having the problem, that as soon as i format a label with .pack() i can't use .configure() on the same label to change its text.
def browseFiles():
global filename
filename = filedialog.askopenfilename(initialdir = "/Desktop",
title = "Explorer",
filetypes = (("Pics",
"*.jpg*"),
("Text",
"*.txt*"),
("All",
"*.*")))
f = open("yeet.txt", "a")
f.write(filename)
f.close()
label_file_explorer.configure(text="You chose: " filename)
The label itself looks like this:
label_file_explorer = Label(window,text = "Label",width = 100, height = 4,fg = "blue").pack()
As soon as i leave the .pack() out i can't see the label, but i don't get an error, so i'd assume it works.
FYI - this is the error message: 'NoneType' object has no attribute 'configure'
CodePudding user response:
I believe that the .pack()
method returns the None
you are seeing.
I think what you meant was this:
label_file_explorer = Label(window,text = "Label",width = 100, height = 4,fg = "blue")
label_file_explorer.pack()