title: Tkinter print specified item from list in loop
body: <p>I've code like below:</p>
  
  <pre><code>from tkinter import *
  
  root = Tk()
  root.title("sample program")
  
  def print_item_from_list(event):
      print(variable)
  
  list = [1, 2, 3, 4, 5]
  seclist = []
  print(list)
  for i in range(0,5):
      variable = list[i]
      sample = Label(text=variable)
      sample.pack()
      sample.bind('&lt;Enter&gt;', print_item_from_list)
  
  root.mainloop()
  </code></pre>
  
  <p>What I want to achieve is that everytime my pointer enter label 'Sample', specified item form list is printed (i.e. when I hover over label '2', I want second object from my list to get printed). I tried already changing <strong>variable</strong> to <strong>list[i]</strong> (Just for tests if it would work) and creating second list and appending to it, but with no luck. My guess is it's somehow connected to Tkniter behaviour.</p>