title: How do I pass arguments to a callback that is bound to an object on a tkinter canvas?
body: <p>I am making a tic-tac-toe game, and when you hit the pause button, (not actually a button, just a rectangle with 2 lines that look like a pause symbol on it that when clicked on, generates a callback), a new canvas covers the the canvas displaying the game and instead displays "Paused", "Resume", "Restart", and "Quit". When you press Resume or Restart, I'm trying to destroy the new canvas, but because it was created in the callback for the pause, it isn't global, and I can't figure out how to pass it on as an argument.</p>
  
  <p>I've tried lambda in multiple different fashions, but that doesn't work.</p>
  
  <pre><code>def resume(event):
      pausedisplay.destroy()
  
  def pause(event):
      pausedisplay = Canvas(game, bg = "grey", highlightbackground = "white", width = 505, height = 505)
  
      pausedtext = pausedisplay.create_text(253,100, font = "Oswald 84 bold underline", fill = "white", text = "Paused")
      resumetext = pausedisplay.create_text(253,225, font = "Oswald 48 bold", fill = "white", text = "Resume")
      restarttext = pausedisplay.create_text(253,300, font = "Oswald 48 bold", fill = "white", text = "Restart")
      quittext = pausedisplay.create_text(253,375, font = "Oswald 48 bold", fill = "white", text = "Quit")
  
      pausedisplay.tag_bind(resumetext,"&lt;Button-1&gt;", resume)
      pausedisplay.tag_bind(restarttext,"&lt;Button-1&gt;", restart)
      pausedisplay.tag_bind(quittext,"&lt;Button-1&gt;", quit)
  
      pausedisplay.grid(row = 0, column = 0)
  </code></pre>
  
  <p>NameError: global name 'pausedisplay' is not defined</p>