title: python tkInter browse folder button
body: <p>I would like to make a browse folder button using tkinter and to store the path into a variable. So far i am able to print the path but i am not able to store it in a variable. Can you please advise?</p>
  <p>Below i attach the code that i use.</p>
  <pre><code>from tkinter import filedialog
  from tkinter import *
  
  def browse_button():
      filename = filedialog.askdirectory()
      print(filename)
      return filename
  
  
  root = Tk()
  v = StringVar()
  button2 = Button(text=&quot;Browse&quot;, command=browse_button).grid(row=0, column=3)
  
  mainloop()
  </code></pre>