title: Python Tkinter: How to config a button that was generated in a loop?
body: <p>I am using Python 2.7 and Tkinter to make a GUI for my code.
  At one point, a frame is filled with many buttons in a loop. When I click on one of the buttons, the function needs to know from where it was called, so I googled and found out this nice way to do it:</p>
  
  <pre><code>def generate_buttons(n):
      for i in xrange(n):
          newbutton = str(i)
          newbutton = Button(myFrame, text=newbutton, command= lambda name=i:print_name(name)).grid(column=i)
  </code></pre>
  
  <p>and:</p>
  
  <pre><code>def print_name(name):
      print name
  </code></pre>
  
  <p>So when I generate my buttons like this:</p>
  
  <pre><code>generate_buttons(5)
  </code></pre>
  
  <p>the 5 buttons appear in one row. If I click on number 3, console prints "3".</p>
  
  <p>Now what do I do if I want to further access the buttons. For example give them a new appearence. If I created just one button, it would be easy:</p>
  
  <pre><code>myButton.Button(text="bla")
  myButton.config(relief=SUNKEN)
  </code></pre>
  
  <p>or </p>
  
  <pre><code>myButton.config(padx=10)
  </code></pre>
  
  <p>But in the loop, I override "newbutton" all the time. Does that mean I cannot get access to the individuals anymore? How do I "address" an object that was iteratively created and thus does not have a name?</p>