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
And, for those who want a Tcl-based solution, here is one:
proc searchtree {} {
set children [.tree children {}]
foreach id $children {
set text [.tree item $id -text]
if {$text eq [.e get]} {
.tree selection set $id
} else {
set children [.tree children $id]
foreach id $children {
set text [.tree item $id -text]
if {$text eq [.e get]} {
.tree selection set $id
}
}
}
.tree see $id
}
}
pack [ttk::treeview .tree]
# Inserted at the root, program chooses id:
.tree insert {} end -id widgets -text "Widget Tour"
# Same thing, but inserted as first child:
.tree insert {} 0 -id gallery -text "Applications"
# Treeview chooses the id:
set id [.tree insert {} end -text "Tutorial"]
# Inserted underneath an existing node:
.tree insert widgets end -text "Canvas"
.tree insert $id end -text "Tree"
pack [button .b -text "Search" -command searchtree]
pack [entry .e ]