Sep-11-2019, 07:36 PM
I get the error "NameError: name 'tkFileDialog' is not defined" in the following code.
If anybody can tell me why, it would be greatly appreciated.
If anybody can tell me why, it would be greatly appreciated.
from tkinter import filedialog from tkinter import * def get_file1(): print("Geting file 1\n") file1 = tkFileDialog.askopenfilename(initialdir = "/",title = "Select file",filetypes = (("jpeg files","*.jpg"),("all files","*.*"))) e1.insert(10,file1) mw = Tk() mw.geometry('350x200+400+200') mw.title("Test Program") w1 = Label(mw, text="Input File: ",font=("Arial Bold",12)).grid(row=0) e1 = Entry(mw) e1.insert(10, "infile.txt") e1.grid(row=0,column=1) Button(mw,text='Search',command=get_file1).grid(row=0, column=2, sticky=W, pady=4) mw.mainloop()