title: Why does this tkinter event function not see the non-event variable?
body: <p>I have a button that is bound to an event function and I want that function to count the number of times the button has been clicked. So I have a variable (clicks), and i want the event function to take clicks as a parameter and increment it by one. Here is my code:</p>
  
  <pre><code>#imports
  import tkinter
  
  #variables
  clicks = 0
  
  #event functions
  def click(event,clicks):
      clicks += 1
      print(clicks)
      return clicks
  
  #create gui
  window = tkinter.Tk()
  
  button = tkinter.Button(text = "click me!")
  button.pack()
  clicks = button.bind("&lt;Button-1&gt;",click)
  
  #run gui
  window.mainloop()
  </code></pre>
  
  <p>When I run the program and click the button, I get a "click() missing 1 required positional argument: 'clicks'" error. But as far as I can tell I have clicks initialized, and click takes and returns clicks, so where have I gone wrong?</p>