title: Print the clicked button's text tkinter
body: <p>Here is my code:</p>
  
  <pre><code>from tkinter import *    
  
  def command(d):
     print(d)
  
  a = Tk()
  b = []
  
  for c in range(0, 5):
      b.append(Button(a, text=c, command=lambda: command(c)))
      b[c].pack()
  
  a.mainloop()
  </code></pre>
  
  <p>When running the script, the buttons all print 4, whereas I want them to print the number shown on them. How can you do this?</p>
  
  <p>I am using Python 3.4</p>