title: Tkinter: Calling function when button is pressed
body: <pre><code>import tkinter as tk
  
  def load(event):
      file = open(textField.GetValue())
      txt.SetValue(file.read())
      file.close()
  
  def save(event):
      file = open(textField.GetValue(), 'w')
      file.write(txt.GetValue())
      file.close()
  
  
  win = tk.Tk() 
  win.title('Text Editor')
  win.geometry('500x500') 
  
  # create text field
  textField = tk.Entry(win, width = 50)
  textField.pack(fill = tk.NONE, side = tk.TOP)
  
  # create button to open file
  openBtn = tk.Button(win, text = 'Open', command = load())
  openBtn.pack(expand = tk.FALSE, fill = tk.X, side = tk.TOP)
  
  # create button to save file
  saveBtn = tk.Button(win, text = 'Save', command = save())
  saveBtn.pack(expand = tk.FALSE, fill = tk.X, side = tk.TOP)
  </code></pre>
  
  <p>I get the error that <code>load and save are missing a position argument: event</code>. I understand the error, but don't understand how to resolve it.</p>