title: How to store a file location into an entry widget - Tkinter
body: <p>I'm having  a trouble to store a file location into a entry widget for my script using Tkinter:</p>
  
  <p>So far I was able to have a browse button working perfectly, however, I cannot assing the variable value that I created <code>parent.filename</code> to store the file location into a entry widget like the photo below shows:</p>
  
  <p><a href="https://i.stack.imgur.com/EyjbL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EyjbL.png" alt="enter image description here"></a></p>
  
  <p>My script following below:</p>
  
  <pre><code>from Tkinter import *
  import ttk
  from PIL import ImageTk, Image
  import os
  import Tkinter, Tkconstants, tkFileDialog
  
  class arquivos:
  
      def __init__(self, parent):     
  
         parent.title('TEXT MINING - HMB QA')
  
         self.gif1 = PhotoImage(file = 'tteste.gif')
         label1 = Label(image=self.gif1)
         label1.image = self.gif1 
         label1.grid(row = 0, column = 0, rowspan=13, sticky=NW)
  
         Label(parent, text='File URL:').grid(row=0, column=1, sticky='e')
         self.v1=Entry(parent, width=90)
         self.v1.grid(row=0, column=2, sticky='we',columnspan=8)
  
  
         self.button3 = Button(parent, text = "Browse", command 
         =self.loadtemplate, width = 10, height=1)        
         self.button3.grid(row=0, column=10, columnspan=2, sticky='w')
  
         Label(parent, text='Filter RO List:').grid(row=1, column=1, 
         sticky='e')
         self.v2=Radiobutton(parent, text="YES", value=1)
         self.v2.grid(row=1,column=2, columnspan=1, sticky='w')
  
  parent=Tk()
  arquivos(parent)
  parent.mainloop(
  </code></pre>
  
  <p>Regarding the function <code>loadtemplate</code> follows the code:</p>
  
  <pre><code> def loadtemplate(self): 
  
      parent.filename = StringVar()        
      parent.filename = tkFileDialog.askopenfilename(initialdir = "/",title 
      = "Select file",filetypes = (("jpeg files","*.jpg"),("all 
      files","*.*")))
      print parent.filename        
      self.v20 = Entry(parent, textvariable=parent.filename, width=90)
      self.v20.grid(row=0,column=2, sticky='we',columnspan=8)  
  </code></pre>
  
  <p>When I hit the <code>Browse</code> button a box pops out and I can select the file directory: 
  The variable <code>parent.filename</code> assigned to store the file location also  works, however, I'm not able to store the variable value into the entry widget <code>self.v1</code></p>
  
  <p>Any help will be highly appreciated</p>