title: Tkinter - How to trace expanding list of variables
body: <p>What I am trying to do track when any values in a list of <code>StringVar</code> change, even when the list is expanding. Any additions to the list before the <code>trace</code> statement will result in the callback. But any additions afterward, such as when pressing a button, will not cause any callback.</p>
  
  <pre><code>import tkinter as tk
  
  root = tk.Tk()
  frame = tk.Frame(root)
  frame.grid(row=0)
  
  L = []
  
  def add_entry(event):
      L.append(tk.StringVar())
      tk.Entry(frame,textvariable=L[len(L)-1]).grid(row=len(L),padx=(10,10),pady=(5,5))
  
  add = tk.Button(frame,text='add Entry',command='buttonpressed')
  add.grid(row=0)
  add.bind('&lt;Button-1&gt;',add_entry)
  
  for i in range(2):
      L.append(tk.StringVar())
      tk.Entry(frame,textvariable=L[len(L)-1]).grid(row=len(L),padx=(10,10),pady=(5,5))
  
  for i in L:
      i.trace('w',lambda *arg:print('Modified'))
  
  root.mainloop()
  </code></pre>
  
  <p>Modifying the first two <code>Entry</code>'s prints out <code>Modified</code>, but any <code>Entry</code>'s after the <code>trace</code> is run, such as the ones produced when a button is pressed, will not.</p>
  
  <p>How do I make it so that <code>trace</code> method will run the callback for the entire list of variables even if the list is expanded?</p>