Saturday, 15 June 2013

Python: Tkinter Treeview Searchable -


Quite a direct question, and despite my best Google-Fu I can not find anything on it.

I have a python app that uses a Tankliner Treviv widget as a table. It works fine for me to use it, but some trees may end up with a few hundred objects.

Is it any way to make tree view discoverable, as far as the tree has been noticed, the user can type some characters and the first alphabet match is highlighted (a different in the window To type the search pattern instead of the unit)?

You can define your own recurring method to search in the Treeview widget, The text can begin on the child's contents: Import tinicator as imported teak import TTC class app (vaccine frame): def __init __ (self, Master): tk.frame .__ init __ (self, master) self Anti = Vaccines Entry (self) self.button = tk.Button (auto, text = 'search', command = self.search) self.tree = ttk.Treeview (self) # ... def search (self, items = '') : Children = self.tree.get_children for children (items): text = self.tree.item (children, 'text') if text.startswith (self.entry.get ()): self.tree.selection_set (Child) Back to right: res = self.search (child) if res: return True

No comments:

Post a Comment