def selectItem(a):
curItem = tree.focus()
print tree.item(curItem)
{'text': 'Name', 'image': '', 'values': [u'Date', u'Time', u'Loc'], 'open': 0, 'tags': ''}
另外请注意,回调将被执行 之前, 在树中的焦点变了,即你将获得该项目 是 您点击的新项目之前选择。解决此问题的一种方法是改用事件类型ButtonRelease
。
tree.bind('<ButtonRelease-1>', selectItem)