I was surprised that the code below prints 'called' three times.
from tkinter import * from tkinter.ttk import * root=Tk() def callback(*e): print('called') tree = Treeview(root) tree.pack() iid = tree.insert('', 0, text='test') tree.selection_set(iid) tree.selection_remove(iid) tree.selection_set(iid) tree.bind('<<TreeviewSelect>>', callback) mainloop() In other words, selection events that occurred _before_ the callback function was bound to the Treeview selections are triggering the function upon binding. AFAIK, no other tk widget/binding combination behaves this way (although I haven't tried all of them). This was a problem because I wanted to reset the contents of the Treeview without triggering a relatively expensive bound function, but found that temporarily unbinding didn't prevent the calls. I've worked around this by using a regular button-click binding for selection instead, but I'm curious if anyone can cast any light on this. Cheers John -- https://mail.python.org/mailman/listinfo/python-list