Fairly straight forward question, and despite my best Google-Fu I can\'t find anything on this.
I have a Python app that uses a Tkinter Treeview widget as a table. This
You can define your own recursive method to search in the Treeview widget, and call selection_set on the appropiate child if its text starts with the content of the entry:
import Tkinter as tk
import ttk
class App(tk.Frame):
def __init__(self, master):
tk.Frame.__init__(self, master)
self.entry = tk.Entry(self)
self.button = tk.Button(self, text='Search', command=self.search)
self.tree = ttk.Treeview(self)
# ...
def search(self, item=''):
children = self.tree.get_children(item)
for child in children:
text = self.tree.item(child, 'text')
if text.startswith(self.entry.get()):
self.tree.selection_set(child)
return True
else:
res = self.search(child)
if res:
return True