I am trying to build a search in ttk.treeview. Once I enter the keyword, all unrelated items are detached. However, when I try to restore the treeview, I have to specify each path and reattach every single item. Is there a better way to do so?
I am thinking about duplicate a treeview at first, and restore from that before every search.
Here is my code. (fileListTemp is a dict: {filename:oid})
def SearchName(*event):
keyword = self.entry_1.get()
for item in self.fileListTemp:
if keyword.lower() not in item.lower():
self.treeview.detach(self.fileListTemp[item])