title: Returning the index of an item clicked in a tkinter Listbox
body: <p>I'm trying to get tkinter to return the index of an item clicked in listbox. Here's my code.</p>
  
  <pre><code>def fileSelection(self):
      selection = listbox.curselection
      print(selection)
  
  listbox.bind("&lt;Button-1&gt;", fileSelection)
  </code></pre>
  
  <p>Right now it prints </p>
  
  <blockquote>
    <p>bound method Listbox.curselection of tkinter.Listbox object at 0x00320E30</p>
  </blockquote>
  
  <p>no matter what item is clicked on. If I change the code to include a button like this:</p>
  
  <pre><code>button = Button(text=u"test", command=OnButtonClick)
  
  def OnButtonClick():
      selection = listbox.curselection()
      print(selection)
  </code></pre>
  
  <p>and select the Listbox item, then click the button, it will print the index of the selected item, as expected, but that's an extra step I don't want. </p>