Artifact
49cc7c1c595321f05a5199bceef2efac07b2903ed88e25a318a25a6bf1897e17:
Attachment "demo.tcl" to
ticket [d82fa2953a]
added by
sbron
2024-08-16 16:12:21.
#!/usr/bin/wish
# -*- tcl -*-
set wut treeview
ttk::frame .f
pack .f -fill both -expand 1
switch $wut {
treeview {
ttk::treeview .wut -show tree -height 10
set cmd [list .wut insert {} end -text]
}
listbox {
listbox .wut -height 10
set cmd [list .wut insert end]
}
text {
text .wut -height 10
set cmd [list apply [list {w str} {
$w insert end $str\n
}] .wut]
}
default {
exit
}
}
ttk::scrollbar .vs -command {.wut yview}
.wut configure -yscrollcommand {.vs set}
for {set i 1} {$i <= 50} {incr i} {
{*}$cmd "Item $i"
}
pack .vs -in .f -side right -fill y
pack .wut -in .f -fill both -expand 1
pack propagate .f 0
set height [winfo reqheight .wut]
.f configure -height [incr height 8] -width 4c