title: Why does my ttk.Treeview click handler return the wrong item on tree.focus()?
body: <p>I have a simple script using a <code>ttk.Treeview</code> instance that I'm populating with the contents of a file system tree. I want to perform a certain operation when (leaf) items are clicked so I configured a handler like so:</p>
  
  <pre><code>self.tree.tag_bind('#entry', '&lt;1&gt;', self.onClick)
  </code></pre>
  
  <p>In the method <code>onClick</code> I am simply printing out the item that was clicked, like so:</p>
  
  <pre><code>def onClick(self, event):
      item_id = str(self.tree.focus())
      print 'Selected item was %s' % item_id
      item = self.tree.item(item_id)
      flag = '#another_tag' in item['tags']
      print '  flag = %s' % flag
  </code></pre>
  
  <p>I'm finding that the messages are lagging the clicks by one. So my first click gets a random value (looks like the root of the tree), and then the n-th click prints out the values for the (n-1)th item that was clicked. </p>
  
  <p>They were inserted like so:
  <code>tree.insert(parent_id, 'end', id, text=id, tags=['#entry'])</code></p>
  
  <p>Anyone know if this is a bug in Tkinter or something that I'm doing wrong?</p>
  
  <p>This appears to be an issue on both Ubuntu Natty as well as OS X Lion (using the default pre-installed versions of Python and Tkinter)</p>