Artifact
6a559004539a412caeeeb70c2501c40b5e6bad2d5abd21a57931a5b6f390c31c:
Attachment "demo.tcl" to
ticket [d82fa2953a]
added by
sbron
2024-08-15 20:06:48.
#!/usr/bin/wish
# -*- tcl -*-
set wut treeview
ttk::frame .f
pack .f -fill both -expand 1
case $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