title: askopenfilename is not defined? - Making a browse button in tkinter
body: <p>The purpose of my code is to create a GUI that has 4 buttons. 2 of them are to open a "browse" window, allowing the user to select a file from a directory. The third button is to allow the user to choose a directory for the final document to be outputted to. The fourth button applies my python code to both files, creating the outputted document.</p>
  
  <p>In attempting to create the "browse" buttons, through many posts here on stackoverflow and on the internet, most solutions include the "askopenfilename" module that is often imported from tkFileDialog. However no matter how I word it, or whatever variations of tkinter modules that i import, I consistently receive the same error messages of "no module name tkfileDialog" or "askopenfilename is not defined".</p>
  
  <p>Am I doing something wrong with my code? Is this a common error found in tkinter with python 3.6? How would one go about creating a browse button that finds a file and adds its path?</p>
  
  <p>Please let me know!</p>
  
  <p>Thanks.</p>
  
  <p>Below is my code:</p>
  
  <pre><code>import os
  #from tkFileDialog import *
  from tkinter import filedialog
  from Tkinter import *
  from tkfileDialog import askopenfilename
  content = 'apple'
  file_path = 'squarebot'
  
  
  #FUNCTIONS
  def browsefunc(): #browse button to search for files
      filename = askopenfilename()
      infile = open(filename, 'r')
      content = infile.read()
      pathadd = os.path.dirname(filename)+filename
  
      pathlabel.delete(0, END)
      pathlabel.insert(0, pathadd)
  
      return content
  def open_file(): #also browse button to search for files - im trying various things to get this to work!
      global content
      global file_path
  
      #filename = filedialog.askopenfilename(filetypes = (typeName {.txt},))
      filename = askopenfilename()                                       
      infile = open(filename, 'r')
      content = infile.read()
      file_path = os.path.dirname(filename)
      entry.delete(0, END)
      entry.insert(0, file_path)
      return content
  
  def process_file(content): #process conversion code
      print(content)
  
  def directoryname():
      directoryname = filedialog.askdirectory() # pick a folder
  
  
  #GUI
  
  root = Tk()
  root.title('DCLF Converter')
  root.geometry("598x600")
  
  mf = Frame(root)
  mf.pack()
  
  
  f1 = Frame(mf, width=600, height=250) #DC file
  f1.pack(fill=X)
  
  f2 = Frame(mf, width=600, height=250) #LF file
  f2.pack(fill=X)
  
  f3 = Frame(mf, width=600, height=250) #destination folder
  f3.pack(fill=X)
  
  f4 = Frame(mf, width=600, height=250) #convert button
  f4.pack()
  
  file_path = StringVar
  
  
  Label(f1,text="Select Your DC File (Only txt files)").grid(row=0, column=0, sticky='e') #DC button
  entry = Entry(f1, width=50, textvariable=file_path)
  entry.grid(row=0,column=1,padx=2,pady=2,sticky='we',columnspan=25)
  
  Label(f2,text="Select Your LF File (Only csv files)").grid(row=0, column=0, sticky='e') #LF button
  entry = Entry(f2, width=50, textvariable=file_path)
  entry.grid(row=0,column=1,padx=2,pady=2,sticky='we',columnspan=25)
  
  Label(f3,text="Select Your Destination Folder").grid(row=0, column=0, sticky='e') #destination folder button
  entry = Entry(f3, width=50, textvariable=directoryname)
  entry.grid(row=0,column=1,padx=2,pady=2,sticky='we',columnspan=25)
  
  Button(f1, text="Browse", command=browsefunc).grid(row=0, column=27, sticky='ew', padx=8, pady=4)#DC button
  Button(f2, text="Browse", command=browsefunc).grid(row=0, column=27, sticky='ew', padx=8, pady=4)#LF button
  Button(f3, text="Browse", command=browsefunc).grid(row=0, column=27, sticky='ew', padx=8, pady=4)#destination folder button
  Button(f4, text="RECONCILE NOW", width=32, command=lambda: process_file(content)).grid(sticky='ew', padx=10, pady=10)#convert button
  
  
  root.mainloop()
  </code></pre>
  
  <p>P.S If you have found any other errors in my code please let me know. I am just starting with tkinter, and as such this may be attributed to something completely unrelated!</p>
  
  <p>Much Appreciated</p>