title: Tkinter program runs button command on startup?
body: <p>So I have a program that is basically supposed to have a button that opens a file dialog in the (username) folder. But when I run the program it opens without even pushing the button. What's more, the button doesn't even show up. So in addition to that problem I have to find a way to turn the selected directory into a string.</p>
  
  <pre><code>import tkinter
  import tkinter.filedialog
  import getpass
  gui = tkinter.Tk()
  user = getpass.getuser()
  tkinter.Button(gui, command=tkinter.filedialog.askopenfilename(initialdir='C:/Users/%s' % user)).pack()
  gui.mainloop()
  </code></pre>