From Newsgroup: comp.lang.tcl
streamtree is a tree/list megawidget for Tk, distributed as a single Tcl module file (pure Tcl, TclOO, requires Tcl 9 and Tk). MIT license.
Tk already has good widgets in this space: ttk::treeview in the core, and tablelist for multi-column lists and trees with editable cells and embedded windows. streamtree covers a corner they don't: lists whose content changes while the user is reading them. In a log viewer, a monitoring panel, or a search whose results stream in, an insert above the visible region normally shifts the whole view, so the line the user was reading jumps away.
streamtree renders the entire tree into one text widget and tracks every row with text marks, so it can compensate: rows arriving above the viewport push the scrollbar, not the text the reader is looking at. A -autofollow option gives the complementary behaviour, following appended rows the way tail -f does, and releasing the moment the user scrolls up; <<AtBottom>> and <<LeftBottom>> events let the host offer a "jump to latest" button.
The text widget substrate also provides what single-line-per-item widgets cannot: rows spanning several wrapped lines, real embedded widgets inside rows, and character-level highlighting inside a row via text tags. A right-pinned strip of sortable, resizable metadata columns is aligned across rows with tab stops. The API follows ttk::treeview vocabulary where it can (insert, delete, detach, item, expand, collapse, move, column), and adds hide/unhide, a reversible filter over a durable node store, so filtering
keeps selection, expansion and scroll position. Every content hook has a working default; the base class renders a plain labelled tree with no
subclass at all.
A benchmark ships in the repository (treeview baseline included): on a Ryzen 5800X it streams about 1,900 single inserts per second into a 10,000-row
tree, painting per arrival, with the reader's line held throughout; a 10, 000-row bulk load takes about 0.6 s. Known limits, also documented: roughly 4.4 kB of memory per rendered row (each row retains its payload dict), no virtualization (collapsed subtrees stay unrendered), and no screen-reader structure.
The module was extracted from questlog, where it renders a live session list; it carries no application code.
https://github.com/overseers-desk/questlog
streamtree-1.0.1.tm sits at the repository root; docs/streamtree.md is the manual. examples/streamtree-demo.tcl runs under bare wish and has a "stream rows" toggle for watching the scroll behaviour. Feedback welcome.
--- Synchronet 3.22a-Linux NewsLink 1.2