title: Returning a value after calling a function with a button in Tkinter
body: <pre><code>from Tkinter import *
  from tkFileDialog import askopenfilename
  from PIL import Image
  def main():
      filename = askopenfilename(filetypes=[("Jpeg","*.jpg")])
  return filename
  root = Tk()
  button = Button(root,text="Open",command=main)
  button.pack()
  root.title("Image Manipulation Program")
  root.mainloop()
  </code></pre>
  
  <p>I am kind of a newbie at programming in general, but I am trying to make an imaging program through the Tkinter GUI library. What I need to be able to do in the code above is return the string that is stored in filename so it is in the global scope of the program and I am able to use it. The problem is I don't know how to do this when calling the function with a button. I cannot find the answer to this problem on any website so I would appreciate anybody's help with this problem. </p>