ZTWHHH commited on
Commit
bf1f5ad
·
verified ·
1 Parent(s): f524f82

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +4 -0
  2. evalkit_llava/lib/pkgconfig/formw.pc +19 -0
  3. evalkit_llava/lib/pkgconfig/history.pc +11 -0
  4. evalkit_llava/lib/pkgconfig/libcrypto.pc +13 -0
  5. evalkit_llava/lib/pkgconfig/liblzma.pc +16 -0
  6. evalkit_llava/lib/pkgconfig/menuw.pc +19 -0
  7. evalkit_llava/lib/pkgconfig/python-3.10.pc +13 -0
  8. evalkit_llava/lib/pkgconfig/python3.pc +13 -0
  9. evalkit_llava/lib/pkgconfig/readline.pc +12 -0
  10. evalkit_llava/lib/pkgconfig/sqlite3.pc +13 -0
  11. evalkit_llava/lib/pkgconfig/tk.pc +15 -0
  12. evalkit_llava/lib/pkgconfig/uuid.pc +11 -0
  13. evalkit_llava/lib/pkgconfig/zlib.pc +13 -0
  14. evalkit_llava/lib/python3.10/lib-dynload/_codecs_jp.cpython-310-x86_64-linux-gnu.so +3 -0
  15. evalkit_llava/lib/python3.10/lib-dynload/_codecs_kr.cpython-310-x86_64-linux-gnu.so +3 -0
  16. evalkit_llava/lib/python3.10/lib-dynload/math.cpython-310-x86_64-linux-gnu.so +3 -0
  17. evalkit_llava/lib/python3.10/lib-dynload/select.cpython-310-x86_64-linux-gnu.so +3 -0
  18. evalkit_llava/lib/tk8.6/demos/aniwave.tcl +104 -0
  19. evalkit_llava/lib/tk8.6/demos/arrow.tcl +241 -0
  20. evalkit_llava/lib/tk8.6/demos/bitmap.tcl +52 -0
  21. evalkit_llava/lib/tk8.6/demos/colors.tcl +99 -0
  22. evalkit_llava/lib/tk8.6/demos/combo.tcl +61 -0
  23. evalkit_llava/lib/tk8.6/demos/cscroll.tcl +172 -0
  24. evalkit_llava/lib/tk8.6/demos/ctext.tcl +176 -0
  25. evalkit_llava/lib/tk8.6/demos/dialog1.tcl +25 -0
  26. evalkit_llava/lib/tk8.6/demos/entry3.tcl +185 -0
  27. evalkit_llava/lib/tk8.6/demos/fontchoose.tcl +67 -0
  28. evalkit_llava/lib/tk8.6/demos/hello +22 -0
  29. evalkit_llava/lib/tk8.6/demos/hscale.tcl +45 -0
  30. evalkit_llava/lib/tk8.6/demos/image2.tcl +108 -0
  31. evalkit_llava/lib/tk8.6/demos/images/flagdown.xbm +27 -0
  32. evalkit_llava/lib/tk8.6/demos/images/flagup.xbm +27 -0
  33. evalkit_llava/lib/tk8.6/demos/images/gray25.xbm +6 -0
  34. evalkit_llava/lib/tk8.6/demos/images/letters.xbm +27 -0
  35. evalkit_llava/lib/tk8.6/demos/images/noletter.xbm +27 -0
  36. evalkit_llava/lib/tk8.6/demos/images/pattern.xbm +6 -0
  37. evalkit_llava/lib/tk8.6/demos/items.tcl +302 -0
  38. evalkit_llava/lib/tk8.6/demos/ixset +328 -0
  39. evalkit_llava/lib/tk8.6/demos/label.tcl +40 -0
  40. evalkit_llava/lib/tk8.6/demos/labelframe.tcl +76 -0
  41. evalkit_llava/lib/tk8.6/demos/mclist.tcl +119 -0
  42. evalkit_llava/lib/tk8.6/demos/msgbox.tcl +62 -0
  43. evalkit_llava/lib/tk8.6/demos/nl.msg +125 -0
  44. evalkit_llava/lib/tk8.6/demos/pendulum.tcl +197 -0
  45. evalkit_llava/lib/tk8.6/demos/plot.tcl +97 -0
  46. evalkit_llava/lib/tk8.6/demos/puzzle.tcl +82 -0
  47. evalkit_llava/lib/tk8.6/demos/rmt +210 -0
  48. evalkit_llava/lib/tk8.6/demos/rolodex +204 -0
  49. evalkit_llava/lib/tk8.6/demos/search.tcl +139 -0
  50. evalkit_llava/lib/tk8.6/demos/style.tcl +155 -0
.gitattributes CHANGED
@@ -121,3 +121,7 @@ evalkit_llava/lib/python3.10/site-packages/setuptools/_vendor/more_itertools/__p
121
  evalkit_llava/lib/python3.10/lib-dynload/_lzma.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
122
  evalkit_llava/lib/libreadline.so filter=lfs diff=lfs merge=lfs -text
123
  evalkit_llava/lib/python3.10/lib-dynload/array.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
121
  evalkit_llava/lib/python3.10/lib-dynload/_lzma.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
122
  evalkit_llava/lib/libreadline.so filter=lfs diff=lfs merge=lfs -text
123
  evalkit_llava/lib/python3.10/lib-dynload/array.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
124
+ evalkit_llava/lib/python3.10/lib-dynload/select.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
125
+ evalkit_llava/lib/python3.10/lib-dynload/_codecs_kr.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
126
+ evalkit_llava/lib/python3.10/lib-dynload/_codecs_jp.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
127
+ evalkit_llava/lib/python3.10/lib-dynload/math.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
evalkit_llava/lib/pkgconfig/formw.pc ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # pkg-config file generated by gen-pkgconfig
2
+ # vile:makemode
3
+
4
+ prefix=/root/envs/evalkit_llava
5
+ exec_prefix=${prefix}
6
+ libdir=${exec_prefix}/lib
7
+ includedir=${prefix}/include/ncursesw
8
+ abi_version=6
9
+ major_version=6
10
+ version=6.4.20221231
11
+
12
+ Name: formw
13
+ Description: ncurses 6.4 add-on library
14
+ Version: ${version}
15
+ URL: https://invisible-island.net/ncurses
16
+ Requires.private: ncursesw
17
+ Libs: -L/root/envs/evalkit_llava/lib -Wl,-O2 -Wl,--sort-common -Wl,--disable-new-dtags -Wl,--gc-sections -Wl,-rpath,/root/envs/evalkit_llava/lib -Wl,-rpath-link,/root/envs/evalkit_llava/lib -lformw
18
+ Libs.private:
19
+ Cflags: -D_GNU_SOURCE -DNCURSES_WIDECHAR -I${includedir} -I/root/envs/evalkit_llava/include
evalkit_llava/lib/pkgconfig/history.pc ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ prefix=/root/envs/evalkit_llava
2
+ exec_prefix=${prefix}
3
+ libdir=${exec_prefix}/lib
4
+ includedir=${prefix}/include
5
+
6
+ Name: History
7
+ Description: Gnu History library for managing previously-entered lines
8
+ URL: http://tiswww.cwru.edu/php/chet/readline/rltop.html
9
+ Version: 8.2
10
+ Libs: -L${libdir} -lhistory
11
+ Cflags: -I${includedir}
evalkit_llava/lib/pkgconfig/libcrypto.pc ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ prefix=/root/envs/evalkit_llava
2
+ exec_prefix=${prefix}
3
+ libdir=${exec_prefix}/lib
4
+ includedir=${prefix}/include
5
+ enginesdir=${libdir}/engines-3
6
+ modulesdir=${libdir}/ossl-modules
7
+
8
+ Name: OpenSSL-libcrypto
9
+ Description: OpenSSL cryptography library
10
+ Version: 3.0.16
11
+ Libs: -L${libdir} -lcrypto
12
+ Libs.private: -ldl -pthread
13
+ Cflags: -I${includedir}
evalkit_llava/lib/pkgconfig/liblzma.pc ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SPDX-License-Identifier: 0BSD
2
+ # Author: Lasse Collin
3
+
4
+ prefix=/root/envs/evalkit_llava
5
+ exec_prefix=${prefix}
6
+ libdir=${exec_prefix}/lib
7
+ includedir=${prefix}/include
8
+
9
+ Name: liblzma
10
+ Description: General purpose data compression library
11
+ URL: https://tukaani.org/xz/
12
+ Version: 5.6.4
13
+ Cflags: -I${includedir}
14
+ Cflags.private: -DLZMA_API_STATIC
15
+ Libs: -L${libdir} -llzma
16
+ Libs.private: -pthread
evalkit_llava/lib/pkgconfig/menuw.pc ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # pkg-config file generated by gen-pkgconfig
2
+ # vile:makemode
3
+
4
+ prefix=/root/envs/evalkit_llava
5
+ exec_prefix=${prefix}
6
+ libdir=${exec_prefix}/lib
7
+ includedir=${prefix}/include/ncursesw
8
+ abi_version=6
9
+ major_version=6
10
+ version=6.4.20221231
11
+
12
+ Name: menuw
13
+ Description: ncurses 6.4 add-on library
14
+ Version: ${version}
15
+ URL: https://invisible-island.net/ncurses
16
+ Requires.private: ncursesw
17
+ Libs: -L/root/envs/evalkit_llava/lib -Wl,-O2 -Wl,--sort-common -Wl,--disable-new-dtags -Wl,--gc-sections -Wl,-rpath,/root/envs/evalkit_llava/lib -Wl,-rpath-link,/root/envs/evalkit_llava/lib -lmenuw
18
+ Libs.private:
19
+ Cflags: -D_GNU_SOURCE -DNCURSES_WIDECHAR -I${includedir} -I/root/envs/evalkit_llava/include
evalkit_llava/lib/pkgconfig/python-3.10.pc ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # See: man pkg-config
2
+ prefix=/root/envs/evalkit_llava
3
+ exec_prefix=${prefix}
4
+ libdir=${exec_prefix}/lib
5
+ includedir=${prefix}/include
6
+
7
+ Name: Python
8
+ Description: Build a C extension for Python
9
+ Requires:
10
+ Version: 3.10
11
+ Libs.private: -lcrypt -lpthread -ldl -lutil -lm
12
+ Libs:
13
+ Cflags: -I${includedir}/python3.10
evalkit_llava/lib/pkgconfig/python3.pc ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # See: man pkg-config
2
+ prefix=/root/envs/evalkit_llava
3
+ exec_prefix=${prefix}
4
+ libdir=${exec_prefix}/lib
5
+ includedir=${prefix}/include
6
+
7
+ Name: Python
8
+ Description: Build a C extension for Python
9
+ Requires:
10
+ Version: 3.10
11
+ Libs.private: -lcrypt -lpthread -ldl -lutil -lm
12
+ Libs:
13
+ Cflags: -I${includedir}/python3.10
evalkit_llava/lib/pkgconfig/readline.pc ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ prefix=/root/envs/evalkit_llava
2
+ exec_prefix=${prefix}
3
+ libdir=${exec_prefix}/lib
4
+ includedir=${prefix}/include
5
+
6
+ Name: Readline
7
+ Description: Gnu Readline library for command line editing
8
+ URL: http://tiswww.cwru.edu/php/chet/readline/rltop.html
9
+ Version: 8.2
10
+ Requires.private: tinfo
11
+ Libs: -L${libdir} -lreadline
12
+ Cflags: -I${includedir}
evalkit_llava/lib/pkgconfig/sqlite3.pc ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Package Information for pkg-config
2
+
3
+ prefix=/root/envs/evalkit_llava
4
+ exec_prefix=${prefix}
5
+ libdir=${exec_prefix}/lib
6
+ includedir=${prefix}/include
7
+
8
+ Name: SQLite
9
+ Description: SQL database engine
10
+ Version: 3.45.3
11
+ Libs: -L${libdir} -lsqlite3
12
+ Libs.private: -lz -lm -ldl -lpthread
13
+ Cflags: -I${includedir}
evalkit_llava/lib/pkgconfig/tk.pc ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # tk pkg-config source file
2
+
3
+ prefix=/root/envs/evalkit_llava
4
+ exec_prefix=/root/envs/evalkit_llava
5
+ libdir=/root/envs/evalkit_llava/lib
6
+ includedir=${prefix}/include
7
+
8
+ Name: The Tk Toolkit
9
+ Description: Tk is a cross-platform graphical user interface toolkit, the standard GUI not only for Tcl, but for many other dynamic languages as well.
10
+ URL: https://www.tcl-lang.org/
11
+ Version: 8.6.14
12
+ Requires: tcl >= 8.6
13
+ Libs: -L${libdir} -ltk8.6 -ltkstub8.6
14
+ Libs.private: -lX11
15
+ Cflags: -I${includedir}
evalkit_llava/lib/pkgconfig/uuid.pc ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ prefix=/root/envs/evalkit_llava
2
+ exec_prefix=/root/envs/evalkit_llava
3
+ libdir=/root/envs/evalkit_llava/lib
4
+ includedir=/root/envs/evalkit_llava/include
5
+
6
+ Name: uuid
7
+ Description: Universally unique id library
8
+ Version: 2.32.1
9
+ Requires:
10
+ Cflags: -I${includedir}/uuid
11
+ Libs: -L${libdir} -luuid
evalkit_llava/lib/pkgconfig/zlib.pc ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ prefix=/root/envs/evalkit_llava
2
+ exec_prefix=/root/envs/evalkit_llava
3
+ libdir=/root/envs/evalkit_llava/lib
4
+ sharedlibdir=/root/envs/evalkit_llava/lib
5
+ includedir=/root/envs/evalkit_llava/include
6
+
7
+ Name: zlib
8
+ Description: zlib compression library
9
+ Version: 1.2.13
10
+
11
+ Requires:
12
+ Libs: -L${libdir} -L${sharedlibdir} -lz
13
+ Cflags: -I${includedir}
evalkit_llava/lib/python3.10/lib-dynload/_codecs_jp.cpython-310-x86_64-linux-gnu.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fdc9d9bed1fce91debd6c129742280fffed2bb488b5a3184508938481ace9b27
3
+ size 327976
evalkit_llava/lib/python3.10/lib-dynload/_codecs_kr.cpython-310-x86_64-linux-gnu.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5814ccaffdc000bca85b530ab79430806da47406e083147384ae3d826f4abf74
3
+ size 180840
evalkit_llava/lib/python3.10/lib-dynload/math.cpython-310-x86_64-linux-gnu.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:928c3a7004d4c116d53bee3f89cda66e8fe059f4104ada956a9a4cf7002a88a2
3
+ size 259288
evalkit_llava/lib/python3.10/lib-dynload/select.cpython-310-x86_64-linux-gnu.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:854664e98e53f855778a476978040a576a949c167674187de51479decdf0c2fd
3
+ size 113568
evalkit_llava/lib/tk8.6/demos/aniwave.tcl ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # aniwave.tcl --
2
+ #
3
+ # This demonstration script illustrates how to adjust canvas item
4
+ # coordinates in a way that does something fairly similar to waveform
5
+ # display.
6
+
7
+ if {![info exists widgetDemo]} {
8
+ error "This script should be run from the \"widget\" demo."
9
+ }
10
+
11
+ package require Tk
12
+
13
+ set w .aniwave
14
+ catch {destroy $w}
15
+ toplevel $w
16
+ wm title $w "Animated Wave Demonstration"
17
+ wm iconname $w "aniwave"
18
+ positionWindow $w
19
+
20
+ label $w.msg -font $font -wraplength 4i -justify left -text "This demonstration contains a canvas widget with a line item inside it. The animation routines work by adjusting the coordinates list of the line; a trace on a variable is used so updates to the variable result in a change of position of the line."
21
+ pack $w.msg -side top
22
+
23
+ ## See Code / Dismiss buttons
24
+ set btns [addSeeDismiss $w.buttons $w]
25
+ pack $btns -side bottom -fill x
26
+
27
+ # Create a canvas large enough to hold the wave. In fact, the wave
28
+ # sticks off both sides of the canvas to prevent visual glitches.
29
+ pack [canvas $w.c -width 300 -height 200 -background black] -padx 10 -pady 10 -expand yes
30
+
31
+ # Ensure that this this is an array
32
+ array set animationCallbacks {}
33
+
34
+ # Creates a coordinates list of a wave. This code does a very sketchy
35
+ # job and relies on Tk's line smoothing to make things look better.
36
+ set waveCoords {}
37
+ for {set x -10} {$x<=300} {incr x 5} {
38
+ lappend waveCoords $x 100
39
+ }
40
+ lappend waveCoords $x 0 [incr x 5] 200
41
+
42
+ # Create a smoothed line and arrange for its coordinates to be the
43
+ # contents of the variable waveCoords.
44
+ $w.c create line $waveCoords -tags wave -width 1 -fill green -smooth 1
45
+ proc waveCoordsTracer {w args} {
46
+ global waveCoords
47
+ # Actual visual update will wait until we have finished
48
+ # processing; Tk does that for us automatically.
49
+ $w.c coords wave $waveCoords
50
+ }
51
+ trace add variable waveCoords write [list waveCoordsTracer $w]
52
+
53
+ # Basic motion handler. Given what direction the wave is travelling
54
+ # in, it advances the y coordinates in the coordinate-list one step in
55
+ # that direction.
56
+ proc basicMotion {} {
57
+ global waveCoords direction
58
+ set oc $waveCoords
59
+ for {set i 1} {$i<[llength $oc]} {incr i 2} {
60
+ if {$direction eq "left"} {
61
+ lset waveCoords $i [lindex $oc \
62
+ [expr {$i+2>[llength $oc] ? 1 : $i+2}]]
63
+ } else {
64
+ lset waveCoords $i \
65
+ [lindex $oc [expr {$i-2<0 ? "end" : $i-2}]]
66
+ }
67
+ }
68
+ }
69
+
70
+ # Oscillation handler. This detects whether to reverse the direction
71
+ # of the wave by checking to see if the peak of the wave has moved off
72
+ # the screen (whose size we know already.)
73
+ proc reverser {} {
74
+ global waveCoords direction
75
+ if {[lindex $waveCoords 1] < 10} {
76
+ set direction "right"
77
+ } elseif {[lindex $waveCoords end] < 10} {
78
+ set direction "left"
79
+ }
80
+ }
81
+
82
+ # Main animation "loop". This calls the two procedures that handle the
83
+ # movement repeatedly by scheduling asynchronous calls back to itself
84
+ # using the [after] command. This procedure is the fundamental basis
85
+ # for all animated effect handling in Tk.
86
+ proc move {} {
87
+ basicMotion
88
+ reverser
89
+
90
+ # Theoretically 100 frames-per-second (==10ms between frames)
91
+ global animationCallbacks
92
+ set animationCallbacks(simpleWave) [after 10 move]
93
+ }
94
+
95
+ # Initialise our remaining animation variables
96
+ set direction "left"
97
+ set animateAfterCallback {}
98
+ # Arrange for the animation loop to stop when the canvas is deleted
99
+ bind $w.c <Destroy> {
100
+ after cancel $animationCallbacks(simpleWave)
101
+ unset animationCallbacks(simpleWave)
102
+ }
103
+ # Start the animation processing
104
+ move
evalkit_llava/lib/tk8.6/demos/arrow.tcl ADDED
@@ -0,0 +1,241 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # arrow.tcl --
2
+ #
3
+ # This demonstration script creates a canvas widget that displays a
4
+ # large line with an arrowhead whose shape can be edited interactively.
5
+
6
+ if {![info exists widgetDemo]} {
7
+ error "This script should be run from the \"widget\" demo."
8
+ }
9
+
10
+ package require Tk
11
+
12
+ # arrowSetup --
13
+ # This procedure regenerates all the text and graphics in the canvas
14
+ # window. It's called when the canvas is initially created, and also
15
+ # whenever any of the parameters of the arrow head are changed
16
+ # interactively.
17
+ #
18
+ # Arguments:
19
+ # c - Name of the canvas widget.
20
+
21
+ proc arrowSetup c {
22
+ upvar #0 demo_arrowInfo v
23
+
24
+ # Remember the current box, if there is one.
25
+
26
+ set tags [$c gettags current]
27
+ if {$tags != ""} {
28
+ set cur [lindex $tags [lsearch -glob $tags box?]]
29
+ } else {
30
+ set cur ""
31
+ }
32
+
33
+ # Create the arrow and outline.
34
+
35
+ $c delete all
36
+ eval {$c create line $v(x1) $v(y) $v(x2) $v(y) -arrow last \
37
+ -width [expr {10*$v(width)}] -arrowshape [list \
38
+ [expr {10*$v(a)}] [expr {10*$v(b)}] [expr {10*$v(c)}]]} \
39
+ $v(bigLineStyle)
40
+ set xtip [expr {$v(x2)-10*$v(b)}]
41
+ set deltaY [expr {10*$v(c)+5*$v(width)}]
42
+ $c create line $v(x2) $v(y) $xtip [expr {$v(y)+$deltaY}] \
43
+ [expr {$v(x2)-10*$v(a)}] $v(y) $xtip [expr {$v(y)-$deltaY}] \
44
+ $v(x2) $v(y) -width 2 -capstyle round -joinstyle round
45
+
46
+ # Create the boxes for reshaping the line and arrowhead.
47
+
48
+ eval {$c create rect [expr {$v(x2)-10*$v(a)-5}] [expr {$v(y)-5}] \
49
+ [expr {$v(x2)-10*$v(a)+5}] [expr {$v(y)+5}] \
50
+ -tags {box1 box}} $v(boxStyle)
51
+ eval {$c create rect [expr {$xtip-5}] [expr {$v(y)-$deltaY-5}] \
52
+ [expr {$xtip+5}] [expr {$v(y)-$deltaY+5}] \
53
+ -tags {box2 box}} $v(boxStyle)
54
+ eval {$c create rect [expr {$v(x1)-5}] [expr {$v(y)-5*$v(width)-5}] \
55
+ [expr {$v(x1)+5}] [expr {$v(y)-5*$v(width)+5}] \
56
+ -tags {box3 box}} $v(boxStyle)
57
+ if {$cur != ""} {
58
+ eval $c itemconfigure $cur $v(activeStyle)
59
+ }
60
+
61
+ # Create three arrows in actual size with the same parameters
62
+
63
+ $c create line [expr {$v(x2)+50}] 0 [expr {$v(x2)+50}] 1000 \
64
+ -width 2
65
+ set tmp [expr {$v(x2)+100}]
66
+ $c create line $tmp [expr {$v(y)-125}] $tmp [expr {$v(y)-75}] \
67
+ -width $v(width) \
68
+ -arrow both -arrowshape "$v(a) $v(b) $v(c)"
69
+ $c create line [expr {$tmp-25}] $v(y) [expr {$tmp+25}] $v(y) \
70
+ -width $v(width) \
71
+ -arrow both -arrowshape "$v(a) $v(b) $v(c)"
72
+ $c create line [expr {$tmp-25}] [expr {$v(y)+75}] [expr {$tmp+25}] \
73
+ [expr {$v(y)+125}] -width $v(width) \
74
+ -arrow both -arrowshape "$v(a) $v(b) $v(c)"
75
+
76
+ # Create a bunch of other arrows and text items showing the
77
+ # current dimensions.
78
+
79
+ set tmp [expr {$v(x2)+10}]
80
+ $c create line $tmp [expr {$v(y)-5*$v(width)}] \
81
+ $tmp [expr {$v(y)-$deltaY}] \
82
+ -arrow both -arrowshape $v(smallTips)
83
+ $c create text [expr {$v(x2)+15}] [expr {$v(y)-$deltaY+5*$v(c)}] \
84
+ -text $v(c) -anchor w
85
+ set tmp [expr {$v(x1)-10}]
86
+ $c create line $tmp [expr {$v(y)-5*$v(width)}] \
87
+ $tmp [expr {$v(y)+5*$v(width)}] \
88
+ -arrow both -arrowshape $v(smallTips)
89
+ $c create text [expr {$v(x1)-15}] $v(y) -text $v(width) -anchor e
90
+ set tmp [expr {$v(y)+5*$v(width)+10*$v(c)+10}]
91
+ $c create line [expr {$v(x2)-10*$v(a)}] $tmp $v(x2) $tmp \
92
+ -arrow both -arrowshape $v(smallTips)
93
+ $c create text [expr {$v(x2)-5*$v(a)}] [expr {$tmp+5}] \
94
+ -text $v(a) -anchor n
95
+ set tmp [expr {$tmp+25}]
96
+ $c create line [expr {$v(x2)-10*$v(b)}] $tmp $v(x2) $tmp \
97
+ -arrow both -arrowshape $v(smallTips)
98
+ $c create text [expr {$v(x2)-5*$v(b)}] [expr {$tmp+5}] \
99
+ -text $v(b) -anchor n
100
+
101
+ $c create text $v(x1) 310 -text "-width $v(width)" \
102
+ -anchor w -font {Helvetica 18}
103
+ $c create text $v(x1) 330 -text "-arrowshape {$v(a) $v(b) $v(c)}" \
104
+ -anchor w -font {Helvetica 18}
105
+
106
+ incr v(count)
107
+ }
108
+
109
+ set w .arrow
110
+ catch {destroy $w}
111
+ toplevel $w
112
+ wm title $w "Arrowhead Editor Demonstration"
113
+ wm iconname $w "arrow"
114
+ positionWindow $w
115
+ set c $w.c
116
+
117
+ label $w.msg -font $font -wraplength 5i -justify left -text "This widget allows you to experiment with different widths and arrowhead shapes for lines in canvases. To change the line width or the shape of the arrowhead, drag any of the three boxes attached to the oversized arrow. The arrows on the right give examples at normal scale. The text at the bottom shows the configuration options as you'd enter them for a canvas line item."
118
+ pack $w.msg -side top
119
+
120
+ ## See Code / Dismiss buttons
121
+ set btns [addSeeDismiss $w.buttons $w]
122
+ pack $btns -side bottom -fill x
123
+
124
+ canvas $c -width 500 -height 350 -relief sunken -borderwidth 2
125
+ pack $c -expand yes -fill both
126
+
127
+ set demo_arrowInfo(a) 8
128
+ set demo_arrowInfo(b) 10
129
+ set demo_arrowInfo(c) 3
130
+ set demo_arrowInfo(width) 2
131
+ set demo_arrowInfo(motionProc) arrowMoveNull
132
+ set demo_arrowInfo(x1) 40
133
+ set demo_arrowInfo(x2) 350
134
+ set demo_arrowInfo(y) 150
135
+ set demo_arrowInfo(smallTips) {5 5 2}
136
+ set demo_arrowInfo(count) 0
137
+ if {[winfo depth $c] > 1} {
138
+ if {[tk windowingsystem] eq "aqua"} {
139
+ set demo_arrowInfo(bigLineStyle) "-fill systemSelectedTextBackgroundColor"
140
+ } else {
141
+ set demo_arrowInfo(bigLineStyle) "-fill LightSeaGreen"
142
+ }
143
+ set demo_arrowInfo(boxStyle) "-fill {} -width 1"
144
+ set demo_arrowInfo(activeStyle) "-fill red -width 1"
145
+ } else {
146
+ # Main widget program sets variable tk_demoDirectory
147
+ set demo_arrowInfo(bigLineStyle) "-fill black \
148
+ -stipple @[file join $tk_demoDirectory images grey.25]"
149
+ set demo_arrowInfo(boxStyle) "-fill {} -outline black -width 1"
150
+ set demo_arrowInfo(activeStyle) "-fill black -outline black -width 1"
151
+ }
152
+ arrowSetup $c
153
+ $c bind box <Enter> "$c itemconfigure current $demo_arrowInfo(activeStyle)"
154
+ $c bind box <Leave> "$c itemconfigure current $demo_arrowInfo(boxStyle)"
155
+ $c bind box <B1-Enter> " "
156
+ $c bind box <B1-Leave> " "
157
+ $c bind box1 <Button-1> {set demo_arrowInfo(motionProc) arrowMove1}
158
+ $c bind box2 <Button-1> {set demo_arrowInfo(motionProc) arrowMove2}
159
+ $c bind box3 <Button-1> {set demo_arrowInfo(motionProc) arrowMove3}
160
+ $c bind box <B1-Motion> "\$demo_arrowInfo(motionProc) $c %x %y"
161
+ bind $c <ButtonRelease-1> "arrowSetup $c"
162
+
163
+ # arrowMove1 --
164
+ # This procedure is called for each mouse motion event on box1 (the
165
+ # one at the vertex of the arrow). It updates the controlling parameters
166
+ # for the line and arrowhead.
167
+ #
168
+ # Arguments:
169
+ # c - The name of the canvas window.
170
+ # x, y - The coordinates of the mouse.
171
+
172
+ proc arrowMove1 {c x y} {
173
+ upvar #0 demo_arrowInfo v
174
+ set newA [expr {($v(x2)+5-round([$c canvasx $x]))/10}]
175
+ if {$newA < 0} {
176
+ set newA 0
177
+ }
178
+ if {$newA > 25} {
179
+ set newA 25
180
+ }
181
+ if {$newA != $v(a)} {
182
+ $c move box1 [expr {10*($v(a)-$newA)}] 0
183
+ set v(a) $newA
184
+ }
185
+ }
186
+
187
+ # arrowMove2 --
188
+ # This procedure is called for each mouse motion event on box2 (the
189
+ # one at the trailing tip of the arrowhead). It updates the controlling
190
+ # parameters for the line and arrowhead.
191
+ #
192
+ # Arguments:
193
+ # c - The name of the canvas window.
194
+ # x, y - The coordinates of the mouse.
195
+
196
+ proc arrowMove2 {c x y} {
197
+ upvar #0 demo_arrowInfo v
198
+ set newB [expr {($v(x2)+5-round([$c canvasx $x]))/10}]
199
+ if {$newB < 0} {
200
+ set newB 0
201
+ }
202
+ if {$newB > 25} {
203
+ set newB 25
204
+ }
205
+ set newC [expr {($v(y)+5-round([$c canvasy $y])-5*$v(width))/10}]
206
+ if {$newC < 0} {
207
+ set newC 0
208
+ }
209
+ if {$newC > 20} {
210
+ set newC 20
211
+ }
212
+ if {($newB != $v(b)) || ($newC != $v(c))} {
213
+ $c move box2 [expr {10*($v(b)-$newB)}] [expr {10*($v(c)-$newC)}]
214
+ set v(b) $newB
215
+ set v(c) $newC
216
+ }
217
+ }
218
+
219
+ # arrowMove3 --
220
+ # This procedure is called for each mouse motion event on box3 (the
221
+ # one that controls the thickness of the line). It updates the
222
+ # controlling parameters for the line and arrowhead.
223
+ #
224
+ # Arguments:
225
+ # c - The name of the canvas window.
226
+ # x, y - The coordinates of the mouse.
227
+
228
+ proc arrowMove3 {c x y} {
229
+ upvar #0 demo_arrowInfo v
230
+ set newWidth [expr {($v(y)+2-round([$c canvasy $y]))/5}]
231
+ if {$newWidth < 0} {
232
+ set newWidth 0
233
+ }
234
+ if {$newWidth > 20} {
235
+ set newWidth 20
236
+ }
237
+ if {$newWidth != $v(width)} {
238
+ $c move box3 0 [expr {5*($v(width)-$newWidth)}]
239
+ set v(width) $newWidth
240
+ }
241
+ }
evalkit_llava/lib/tk8.6/demos/bitmap.tcl ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # bitmap.tcl --
2
+ #
3
+ # This demonstration script creates a toplevel window that displays
4
+ # all of Tk's built-in bitmaps.
5
+
6
+ if {![info exists widgetDemo]} {
7
+ error "This script should be run from the \"widget\" demo."
8
+ }
9
+
10
+ package require Tk
11
+
12
+ # bitmapRow --
13
+ # Create a row of bitmap items in a window.
14
+ #
15
+ # Arguments:
16
+ # w - The window that is to contain the row.
17
+ # args - The names of one or more bitmaps, which will be displayed
18
+ # in a new row across the bottom of w along with their
19
+ # names.
20
+
21
+ proc bitmapRow {w args} {
22
+ frame $w
23
+ pack $w -side top -fill both
24
+ set i 0
25
+ foreach bitmap $args {
26
+ frame $w.$i
27
+ pack $w.$i -side left -fill both -pady .25c -padx .25c
28
+ label $w.$i.bitmap -bitmap $bitmap
29
+ label $w.$i.label -text $bitmap -width 9
30
+ pack $w.$i.label $w.$i.bitmap -side bottom
31
+ incr i
32
+ }
33
+ }
34
+
35
+ set w .bitmap
36
+ catch {destroy $w}
37
+ toplevel $w
38
+ wm title $w "Bitmap Demonstration"
39
+ wm iconname $w "bitmap"
40
+ positionWindow $w
41
+
42
+ label $w.msg -font $font -wraplength 4i -justify left -text "This window displays all of Tk's built-in bitmaps, along with the names you can use for them in Tcl scripts."
43
+ pack $w.msg -side top
44
+
45
+ ## See Code / Dismiss buttons
46
+ set btns [addSeeDismiss $w.buttons $w]
47
+ pack $btns -side bottom -fill x
48
+
49
+ frame $w.frame
50
+ bitmapRow $w.frame.0 error gray12 gray25 gray50 gray75
51
+ bitmapRow $w.frame.1 hourglass info question questhead warning
52
+ pack $w.frame -side top -expand yes -fill both
evalkit_llava/lib/tk8.6/demos/colors.tcl ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # colors.tcl --
2
+ #
3
+ # This demonstration script creates a listbox widget that displays
4
+ # many of the colors from the X color database. You can click on
5
+ # a color to change the application's palette.
6
+
7
+ if {![info exists widgetDemo]} {
8
+ error "This script should be run from the \"widget\" demo."
9
+ }
10
+
11
+ package require Tk
12
+
13
+ set w .colors
14
+ catch {destroy $w}
15
+ toplevel $w
16
+ wm title $w "Listbox Demonstration (colors)"
17
+ wm iconname $w "Listbox"
18
+ positionWindow $w
19
+
20
+ label $w.msg -font $font -wraplength 4i -justify left -text "A listbox containing several color names is displayed below, along with a scrollbar. You can scan the list either using the scrollbar or by dragging in the listbox window with button 2 pressed. If you double-click button 1 on a color, then the application's color palette will be set to match that color"
21
+ pack $w.msg -side top
22
+
23
+ ## See Code / Dismiss buttons
24
+ set btns [addSeeDismiss $w.buttons $w]
25
+ pack $btns -side bottom -fill x
26
+
27
+ frame $w.frame -borderwidth 10
28
+ pack $w.frame -side top -expand yes -fill y
29
+
30
+ scrollbar $w.frame.scroll -command "$w.frame.list yview"
31
+ listbox $w.frame.list -yscroll "$w.frame.scroll set" \
32
+ -width 20 -height 16 -setgrid 1
33
+ pack $w.frame.list $w.frame.scroll -side left -fill y -expand 1
34
+
35
+ bind $w.frame.list <Double-Button-1> {
36
+ tk_setPalette [selection get]
37
+ }
38
+ $w.frame.list insert 0 gray60 gray70 gray80 gray85 gray90 gray95 \
39
+ snow1 snow2 snow3 snow4 seashell1 seashell2 \
40
+ seashell3 seashell4 AntiqueWhite1 AntiqueWhite2 AntiqueWhite3 \
41
+ AntiqueWhite4 bisque1 bisque2 bisque3 bisque4 PeachPuff1 \
42
+ PeachPuff2 PeachPuff3 PeachPuff4 NavajoWhite1 NavajoWhite2 \
43
+ NavajoWhite3 NavajoWhite4 LemonChiffon1 LemonChiffon2 \
44
+ LemonChiffon3 LemonChiffon4 cornsilk1 cornsilk2 cornsilk3 \
45
+ cornsilk4 ivory1 ivory2 ivory3 ivory4 honeydew1 honeydew2 \
46
+ honeydew3 honeydew4 LavenderBlush1 LavenderBlush2 \
47
+ LavenderBlush3 LavenderBlush4 MistyRose1 MistyRose2 \
48
+ MistyRose3 MistyRose4 azure1 azure2 azure3 azure4 \
49
+ SlateBlue1 SlateBlue2 SlateBlue3 SlateBlue4 RoyalBlue1 \
50
+ RoyalBlue2 RoyalBlue3 RoyalBlue4 blue1 blue2 blue3 blue4 \
51
+ DodgerBlue1 DodgerBlue2 DodgerBlue3 DodgerBlue4 SteelBlue1 \
52
+ SteelBlue2 SteelBlue3 SteelBlue4 DeepSkyBlue1 DeepSkyBlue2 \
53
+ DeepSkyBlue3 DeepSkyBlue4 SkyBlue1 SkyBlue2 SkyBlue3 \
54
+ SkyBlue4 LightSkyBlue1 LightSkyBlue2 LightSkyBlue3 \
55
+ LightSkyBlue4 SlateGray1 SlateGray2 SlateGray3 SlateGray4 \
56
+ LightSteelBlue1 LightSteelBlue2 LightSteelBlue3 \
57
+ LightSteelBlue4 LightBlue1 LightBlue2 LightBlue3 \
58
+ LightBlue4 LightCyan1 LightCyan2 LightCyan3 LightCyan4 \
59
+ PaleTurquoise1 PaleTurquoise2 PaleTurquoise3 PaleTurquoise4 \
60
+ CadetBlue1 CadetBlue2 CadetBlue3 CadetBlue4 turquoise1 \
61
+ turquoise2 turquoise3 turquoise4 cyan1 cyan2 cyan3 cyan4 \
62
+ DarkSlateGray1 DarkSlateGray2 DarkSlateGray3 \
63
+ DarkSlateGray4 aquamarine1 aquamarine2 aquamarine3 \
64
+ aquamarine4 DarkSeaGreen1 DarkSeaGreen2 DarkSeaGreen3 \
65
+ DarkSeaGreen4 SeaGreen1 SeaGreen2 SeaGreen3 SeaGreen4 \
66
+ PaleGreen1 PaleGreen2 PaleGreen3 PaleGreen4 SpringGreen1 \
67
+ SpringGreen2 SpringGreen3 SpringGreen4 green1 green2 \
68
+ green3 green4 chartreuse1 chartreuse2 chartreuse3 \
69
+ chartreuse4 OliveDrab1 OliveDrab2 OliveDrab3 OliveDrab4 \
70
+ DarkOliveGreen1 DarkOliveGreen2 DarkOliveGreen3 \
71
+ DarkOliveGreen4 khaki1 khaki2 khaki3 khaki4 \
72
+ LightGoldenrod1 LightGoldenrod2 LightGoldenrod3 \
73
+ LightGoldenrod4 LightYellow1 LightYellow2 LightYellow3 \
74
+ LightYellow4 yellow1 yellow2 yellow3 yellow4 gold1 gold2 \
75
+ gold3 gold4 goldenrod1 goldenrod2 goldenrod3 goldenrod4 \
76
+ DarkGoldenrod1 DarkGoldenrod2 DarkGoldenrod3 DarkGoldenrod4 \
77
+ RosyBrown1 RosyBrown2 RosyBrown3 RosyBrown4 IndianRed1 \
78
+ IndianRed2 IndianRed3 IndianRed4 sienna1 sienna2 sienna3 \
79
+ sienna4 burlywood1 burlywood2 burlywood3 burlywood4 wheat1 \
80
+ wheat2 wheat3 wheat4 tan1 tan2 tan3 tan4 chocolate1 \
81
+ chocolate2 chocolate3 chocolate4 firebrick1 firebrick2 \
82
+ firebrick3 firebrick4 brown1 brown2 brown3 brown4 salmon1 \
83
+ salmon2 salmon3 salmon4 LightSalmon1 LightSalmon2 \
84
+ LightSalmon3 LightSalmon4 orange1 orange2 orange3 orange4 \
85
+ DarkOrange1 DarkOrange2 DarkOrange3 DarkOrange4 coral1 \
86
+ coral2 coral3 coral4 tomato1 tomato2 tomato3 tomato4 \
87
+ OrangeRed1 OrangeRed2 OrangeRed3 OrangeRed4 red1 red2 red3 \
88
+ red4 DeepPink1 DeepPink2 DeepPink3 DeepPink4 HotPink1 \
89
+ HotPink2 HotPink3 HotPink4 pink1 pink2 pink3 pink4 \
90
+ LightPink1 LightPink2 LightPink3 LightPink4 PaleVioletRed1 \
91
+ PaleVioletRed2 PaleVioletRed3 PaleVioletRed4 maroon1 \
92
+ maroon2 maroon3 maroon4 VioletRed1 VioletRed2 VioletRed3 \
93
+ VioletRed4 magenta1 magenta2 magenta3 magenta4 orchid1 \
94
+ orchid2 orchid3 orchid4 plum1 plum2 plum3 plum4 \
95
+ MediumOrchid1 MediumOrchid2 MediumOrchid3 MediumOrchid4 \
96
+ DarkOrchid1 DarkOrchid2 DarkOrchid3 DarkOrchid4 purple1 \
97
+ purple2 purple3 purple4 MediumPurple1 MediumPurple2 \
98
+ MediumPurple3 MediumPurple4 thistle1 thistle2 thistle3 \
99
+ thistle4
evalkit_llava/lib/tk8.6/demos/combo.tcl ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # combo.tcl --
2
+ #
3
+ # This demonstration script creates several combobox widgets.
4
+
5
+ if {![info exists widgetDemo]} {
6
+ error "This script should be run from the \"widget\" demo."
7
+ }
8
+
9
+ package require Tk
10
+
11
+ set w .combo
12
+ catch {destroy $w}
13
+ toplevel $w
14
+ wm title $w "Combobox Demonstration"
15
+ wm iconname $w "combo"
16
+ positionWindow $w
17
+
18
+ ttk::label $w.msg -font $font -wraplength 5i -justify left -text "Three different\
19
+ combo-boxes are displayed below. You can add characters to the first\
20
+ one by pointing, clicking and typing, just as with an entry; pressing\
21
+ Return will cause the current value to be added to the list that is\
22
+ selectable from the drop-down list, and you can choose other values\
23
+ by pressing the Down key, using the arrow keys to pick another one,\
24
+ and pressing Return again. The second combo-box is fixed to a\
25
+ particular value, and cannot be modified at all. The third one only\
26
+ allows you to select values from its drop-down list of Australian\
27
+ cities."
28
+ pack $w.msg -side top -fill x
29
+
30
+ ## See Code / Dismiss buttons
31
+ set btns [addSeeDismiss $w.buttons $w {firstValue secondValue ozCity}]
32
+ pack $btns -side bottom -fill x
33
+
34
+ ttk::frame $w.f
35
+ pack $w.f -fill both -expand 1
36
+ set w $w.f
37
+
38
+ set australianCities {
39
+ Canberra Sydney Melbourne Perth Adelaide Brisbane
40
+ Hobart Darwin "Alice Springs"
41
+ }
42
+ set secondValue unchangable
43
+ set ozCity Sydney
44
+
45
+ ttk::labelframe $w.c1 -text "Fully Editable"
46
+ ttk::combobox $w.c1.c -textvariable firstValue
47
+ ttk::labelframe $w.c2 -text Disabled
48
+ ttk::combobox $w.c2.c -textvariable secondValue -state disabled
49
+ ttk::labelframe $w.c3 -text "Defined List Only"
50
+ ttk::combobox $w.c3.c -textvariable ozCity -state readonly \
51
+ -values $australianCities
52
+ bind $w.c1.c <Return> {
53
+ if {[%W get] ni [%W cget -values]} {
54
+ %W configure -values [concat [%W cget -values] [list [%W get]]]
55
+ }
56
+ }
57
+
58
+ pack $w.c1 $w.c2 $w.c3 -side top -pady 5 -padx 10
59
+ pack $w.c1.c -pady 5 -padx 10
60
+ pack $w.c2.c -pady 5 -padx 10
61
+ pack $w.c3.c -pady 5 -padx 10
evalkit_llava/lib/tk8.6/demos/cscroll.tcl ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # cscroll.tcl --
2
+ #
3
+ # This demonstration script creates a simple canvas that can be
4
+ # scrolled in two dimensions.
5
+
6
+ if {![info exists widgetDemo]} {
7
+ error "This script should be run from the \"widget\" demo."
8
+ }
9
+
10
+ package require Tk
11
+
12
+ set w .cscroll
13
+ catch {destroy $w}
14
+ toplevel $w
15
+ wm title $w "Scrollable Canvas Demonstration"
16
+ wm iconname $w "cscroll"
17
+ positionWindow $w
18
+ set c $w.c
19
+
20
+ label $w.msg -font $font -wraplength 4i -justify left -text "This window displays a canvas widget that can be scrolled either using the scrollbars or by dragging with button 2 in the canvas. If you click button 1 on one of the rectangles, its indices will be printed on stdout."
21
+ pack $w.msg -side top
22
+
23
+ ## See Code / Dismiss buttons
24
+ set btns [addSeeDismiss $w.buttons $w]
25
+ pack $btns -side bottom -fill x
26
+
27
+ frame $w.grid
28
+ scrollbar $w.hscroll -orient horizontal -command "$c xview"
29
+ scrollbar $w.vscroll -command "$c yview"
30
+ canvas $c -relief sunken -borderwidth 2 -scrollregion {-11c -11c 50c 20c} \
31
+ -xscrollcommand "$w.hscroll set" \
32
+ -yscrollcommand "$w.vscroll set"
33
+ pack $w.grid -expand yes -fill both -padx 1 -pady 1
34
+ grid rowconfig $w.grid 0 -weight 1 -minsize 0
35
+ grid columnconfig $w.grid 0 -weight 1 -minsize 0
36
+
37
+ grid $c -padx 1 -in $w.grid -pady 1 \
38
+ -row 0 -column 0 -rowspan 1 -columnspan 1 -sticky news
39
+ grid $w.vscroll -in $w.grid -padx 1 -pady 1 \
40
+ -row 0 -column 1 -rowspan 1 -columnspan 1 -sticky news
41
+ grid $w.hscroll -in $w.grid -padx 1 -pady 1 \
42
+ -row 1 -column 0 -rowspan 1 -columnspan 1 -sticky news
43
+
44
+
45
+ set bg [lindex [$c config -bg] 4]
46
+ for {set i 0} {$i < 20} {incr i} {
47
+ set x [expr {-10 + 3*$i}]
48
+ for {set j 0; set y -10} {$j < 10} {incr j; incr y 3} {
49
+ $c create rect ${x}c ${y}c [expr {$x+2}]c [expr {$y+2}]c \
50
+ -fill $bg -tags rect
51
+ $c create text [expr {$x+1}]c [expr {$y+1}]c -text "$i,$j" \
52
+ -anchor center -tags text
53
+ }
54
+ }
55
+
56
+ $c bind all <Enter> "scrollEnter $c"
57
+ $c bind all <Leave> "scrollLeave $c"
58
+ $c bind all <Button-1> "scrollButton $c"
59
+ if {([tk windowingsystem] eq "aqua") && ![package vsatisfies [package provide Tk] 8.7-]} {
60
+ bind $c <Button-3> "$c scan mark %x %y"
61
+ bind $c <B3-Motion> "$c scan dragto %x %y"
62
+ bind $c <MouseWheel> {
63
+ %W yview scroll [expr {-%D}] units
64
+ }
65
+ bind $c <Option-MouseWheel> {
66
+ %W yview scroll [expr {-10*%D}] units
67
+ }
68
+ bind $c <Shift-MouseWheel> {
69
+ %W xview scroll [expr {-%D}] units
70
+ }
71
+ bind $c <Shift-Option-MouseWheel> {
72
+ %W xview scroll [expr {-10*%D}] units
73
+ }
74
+ } else {
75
+ bind $c <Button-2> "$c scan mark %x %y"
76
+ bind $c <B2-Motion> "$c scan dragto %x %y"
77
+ # We must make sure that positive and negative movements are rounded
78
+ # equally to integers, avoiding the problem that
79
+ # (int)1/-30 = -1,
80
+ # but
81
+ # (int)-1/-30 = 0
82
+ # The following code ensure equal +/- behaviour.
83
+ bind $c <MouseWheel> {
84
+ if {%D >= 0} {
85
+ %W yview scroll [expr {%D/-30}] units
86
+ } else {
87
+ %W yview scroll [expr {(%D-29)/-30}] units
88
+ }
89
+ }
90
+ bind $c <Option-MouseWheel> {
91
+ if {%D >= 0} {
92
+ %W yview scroll [expr {%D/-3}] units
93
+ } else {
94
+ %W yview scroll [expr {(%D-2)/-3}] units
95
+ }
96
+ }
97
+ bind $c <Shift-MouseWheel> {
98
+ if {%D >= 0} {
99
+ %W xview scroll [expr {%D/-30}] units
100
+ } else {
101
+ %W xview scroll [expr {(%D-29)/-30}] units
102
+ }
103
+ }
104
+ bind $c <Shift-Option-MouseWheel> {
105
+ if {%D >= 0} {
106
+ %W xview scroll [expr {%D/-3}] units
107
+ } else {
108
+ %W xview scroll [expr {(%D-2)/-3}] units
109
+ }
110
+ }
111
+ }
112
+
113
+ if {[tk windowingsystem] eq "x11" && ![package vsatisfies [package provide Tk] 8.7-]} {
114
+ # Support for mousewheels on Linux/Unix commonly comes through mapping
115
+ # the wheel to the extended buttons. If you have a mousewheel, find
116
+ # Linux configuration info at:
117
+ # https://linuxreviews.org/HOWTO_change_the_mouse_speed_in_X
118
+ bind $c <Button-4> {
119
+ if {!$tk_strictMotif} {
120
+ %W yview scroll -5 units
121
+ }
122
+ }
123
+ bind $c <Shift-Button-4> {
124
+ if {!$tk_strictMotif} {
125
+ %W xview scroll -5 units
126
+ }
127
+ }
128
+ bind $c <Button-5> {
129
+ if {!$tk_strictMotif} {
130
+ %W yview scroll 5 units
131
+ }
132
+ }
133
+ bind $c <Shift-Button-5> {
134
+ if {!$tk_strictMotif} {
135
+ %W xview scroll 5 units
136
+ }
137
+ }
138
+ }
139
+
140
+
141
+ proc scrollEnter canvas {
142
+ global oldFill
143
+ set id [$canvas find withtag current]
144
+ if {[lsearch [$canvas gettags current] text] >= 0} {
145
+ set id [expr {$id-1}]
146
+ }
147
+ set oldFill [lindex [$canvas itemconfig $id -fill] 4]
148
+ if {[winfo depth $canvas] > 1} {
149
+ if {[tk windowingsystem] eq "aqua"} {
150
+ $canvas itemconfigure $id -fill systemSelectedTextBackgroundColor
151
+ } else {
152
+ $canvas itemconfigure $id -fill LightSeaGreen
153
+ }
154
+ }
155
+ }
156
+
157
+ proc scrollLeave canvas {
158
+ global oldFill
159
+ set id [$canvas find withtag current]
160
+ if {[lsearch [$canvas gettags current] text] >= 0} {
161
+ set id [expr {$id-1}]
162
+ }
163
+ $canvas itemconfigure $id -fill $oldFill
164
+ }
165
+
166
+ proc scrollButton canvas {
167
+ set id [$canvas find withtag current]
168
+ if {[lsearch [$canvas gettags current] text] < 0} {
169
+ set id [expr {$id+1}]
170
+ }
171
+ puts stdout "You buttoned at [lindex [$canvas itemconf $id -text] 4]"
172
+ }
evalkit_llava/lib/tk8.6/demos/ctext.tcl ADDED
@@ -0,0 +1,176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ctext.tcl --
2
+ #
3
+ # This demonstration script creates a canvas widget with a text
4
+ # item that can be edited and reconfigured in various ways.
5
+
6
+ if {![info exists widgetDemo]} {
7
+ error "This script should be run from the \"widget\" demo."
8
+ }
9
+
10
+ package require Tk
11
+
12
+ set w .ctext
13
+ catch {destroy $w}
14
+ toplevel $w
15
+ wm title $w "Canvas Text Demonstration"
16
+ wm iconname $w "Text"
17
+ positionWindow $w
18
+ set c $w.c
19
+
20
+ label $w.msg -font $font -wraplength 5i -justify left -text "This window displays a string of text to demonstrate the text facilities of canvas widgets. You can click in the boxes to adjust the position of the text relative to its positioning point or change its justification, and on a pie slice to change its angle. The text also supports the following simple bindings for editing:
21
+ 1. You can point, click, and type.
22
+ 2. You can also select with button 1.
23
+ 3. You can copy the selection to the mouse position with button 2.
24
+ 4. Backspace and Control+h delete the selection if there is one;
25
+ otherwise they delete the character just before the insertion cursor.
26
+ 5. Delete deletes the selection if there is one; otherwise it deletes
27
+ the character just after the insertion cursor."
28
+ pack $w.msg -side top
29
+
30
+ ## See Code / Dismiss buttons
31
+ set btns [addSeeDismiss $w.buttons $w]
32
+ pack $btns -side bottom -fill x
33
+
34
+ canvas $c -relief flat -borderwidth 0 -width 500 -height 350
35
+ pack $w.c -side top -expand yes -fill both
36
+
37
+ set textFont {Helvetica 24}
38
+
39
+ $c create rectangle 245 195 255 205 -outline black -fill red
40
+
41
+ # First, create the text item and give it bindings so it can be edited.
42
+
43
+ $c addtag text withtag [$c create text 250 200 -text "This is just a string of text to demonstrate the text facilities of canvas widgets. Bindings have been defined to support editing (see above)." -width 440 -anchor n -font $textFont -justify left]
44
+ $c bind text <Button-1> "textB1Press $c %x %y"
45
+ $c bind text <B1-Motion> "textB1Move $c %x %y"
46
+ $c bind text <Shift-Button-1> "$c select adjust current @%x,%y"
47
+ $c bind text <Shift-B1-Motion> "textB1Move $c %x %y"
48
+ $c bind text <Key> "textInsert $c %A"
49
+ $c bind text <Return> "textInsert $c \\n"
50
+ $c bind text <Control-h> "textBs $c"
51
+ $c bind text <BackSpace> "textBs $c"
52
+ $c bind text <Delete> "textDel $c"
53
+ if {[tk windowingsystem] eq "aqua" && ![package vsatisfies [package provide Tk] 8.7-]} {
54
+ $c bind text <Button-3> "textPaste $c @%x,%y"
55
+ } else {
56
+ $c bind text <Button-2> "textPaste $c @%x,%y"
57
+ }
58
+
59
+ # Next, create some items that allow the text's anchor position
60
+ # to be edited.
61
+
62
+ proc mkTextConfigBox {w x y option value color} {
63
+ set item [$w create rect $x $y [expr {$x+30}] [expr {$y+30}] \
64
+ -outline black -fill $color -width 1]
65
+ $w bind $item <Button-1> "$w itemconf text $option $value"
66
+ $w addtag config withtag $item
67
+ }
68
+ proc mkTextConfigPie {w x y a option value color} {
69
+ set item [$w create arc $x $y [expr {$x+90}] [expr {$y+90}] \
70
+ -start [expr {$a-15}] -extent 30 -outline black -fill $color \
71
+ -width 1]
72
+ $w bind $item <Button-1> "$w itemconf text $option $value"
73
+ $w addtag config withtag $item
74
+ }
75
+
76
+ set x 50
77
+ set y 50
78
+ set color LightSkyBlue1
79
+ mkTextConfigBox $c $x $y -anchor se $color
80
+ mkTextConfigBox $c [expr {$x+30}] [expr {$y }] -anchor s $color
81
+ mkTextConfigBox $c [expr {$x+60}] [expr {$y }] -anchor sw $color
82
+ mkTextConfigBox $c [expr {$x }] [expr {$y+30}] -anchor e $color
83
+ mkTextConfigBox $c [expr {$x+30}] [expr {$y+30}] -anchor center $color
84
+ mkTextConfigBox $c [expr {$x+60}] [expr {$y+30}] -anchor w $color
85
+ mkTextConfigBox $c [expr {$x }] [expr {$y+60}] -anchor ne $color
86
+ mkTextConfigBox $c [expr {$x+30}] [expr {$y+60}] -anchor n $color
87
+ mkTextConfigBox $c [expr {$x+60}] [expr {$y+60}] -anchor nw $color
88
+ set item [$c create rect \
89
+ [expr {$x+40}] [expr {$y+40}] [expr {$x+50}] [expr {$y+50}] \
90
+ -outline black -fill red]
91
+ $c bind $item <Button-1> "$c itemconf text -anchor center"
92
+ $c create text [expr {$x+45}] [expr {$y-5}] \
93
+ -text {Text Position} -anchor s -font {Times 20} -fill brown
94
+
95
+ # Now create some items that allow the text's angle to be changed.
96
+
97
+ set x 205
98
+ set y 50
99
+ set color Yellow
100
+ mkTextConfigPie $c $x $y 0 -angle 90 $color
101
+ mkTextConfigPie $c $x $y 30 -angle 120 $color
102
+ mkTextConfigPie $c $x $y 60 -angle 150 $color
103
+ mkTextConfigPie $c $x $y 90 -angle 180 $color
104
+ mkTextConfigPie $c $x $y 120 -angle 210 $color
105
+ mkTextConfigPie $c $x $y 150 -angle 240 $color
106
+ mkTextConfigPie $c $x $y 180 -angle 270 $color
107
+ mkTextConfigPie $c $x $y 210 -angle 300 $color
108
+ mkTextConfigPie $c $x $y 240 -angle 330 $color
109
+ mkTextConfigPie $c $x $y 270 -angle 0 $color
110
+ mkTextConfigPie $c $x $y 300 -angle 30 $color
111
+ mkTextConfigPie $c $x $y 330 -angle 60 $color
112
+ $c create text [expr {$x+45}] [expr {$y-5}] \
113
+ -text {Text Angle} -anchor s -font {Times 20} -fill brown
114
+
115
+ # Lastly, create some items that allow the text's justification to be
116
+ # changed.
117
+
118
+ set x 350
119
+ set y 50
120
+ set color SeaGreen2
121
+ mkTextConfigBox $c $x $y -justify left $color
122
+ mkTextConfigBox $c [expr {$x+30}] $y -justify center $color
123
+ mkTextConfigBox $c [expr {$x+60}] $y -justify right $color
124
+ $c create text [expr {$x+45}] [expr {$y-5}] \
125
+ -text {Justification} -anchor s -font {Times 20} -fill brown
126
+
127
+ $c bind config <Enter> "textEnter $c"
128
+ $c bind config <Leave> "$c itemconf current -fill \$textConfigFill"
129
+
130
+ set textConfigFill {}
131
+
132
+ proc textEnter {w} {
133
+ global textConfigFill
134
+ set textConfigFill [lindex [$w itemconfig current -fill] 4]
135
+ $w itemconfig current -fill black
136
+ }
137
+
138
+ proc textInsert {w string} {
139
+ if {$string == ""} {
140
+ return
141
+ }
142
+ catch {$w dchars text sel.first sel.last}
143
+ $w insert text insert $string
144
+ }
145
+
146
+ proc textPaste {w pos} {
147
+ catch {
148
+ $w insert text $pos [selection get]
149
+ }
150
+ }
151
+
152
+ proc textB1Press {w x y} {
153
+ $w icursor current @$x,$y
154
+ $w focus current
155
+ focus $w
156
+ $w select from current @$x,$y
157
+ }
158
+
159
+ proc textB1Move {w x y} {
160
+ $w select to current @$x,$y
161
+ }
162
+
163
+ proc textBs {w} {
164
+ if {![catch {$w dchars text sel.first sel.last}]} {
165
+ return
166
+ }
167
+ set char [expr {[$w index text insert] - 1}]
168
+ if {$char >= 0} {$w dchar text $char}
169
+ }
170
+
171
+ proc textDel {w} {
172
+ if {![catch {$w dchars text sel.first sel.last}]} {
173
+ return
174
+ }
175
+ $w dchars text insert
176
+ }
evalkit_llava/lib/tk8.6/demos/dialog1.tcl ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # dialog1.tcl --
2
+ #
3
+ # This demonstration script creates a dialog box with a local grab.
4
+
5
+ interp create child
6
+ load {} Tk child
7
+ child eval {
8
+ wm title . child
9
+ wm geometry . +700+30
10
+ pack [text .t -width 30 -height 10]
11
+ }
12
+
13
+ after idle {.dialog1.msg configure -wraplength 4i}
14
+ set i [tk_dialog .dialog1 "Dialog with local grab" {This is a modal dialog box. It uses Tk's "grab" command to create a "local grab" on the dialog box. The grab prevents any mouse or keyboard events from getting to any other windows in the application until you have answered the dialog by invoking one of the buttons below. However, you can still interact with other applications. For example, you should be able to edit text in the window named "child" which was created by a child interpreter.} \
15
+ info 0 OK Cancel {Show Code}]
16
+
17
+ switch $i {
18
+ 0 {puts "You pressed OK"}
19
+ 1 {puts "You pressed Cancel"}
20
+ 2 {showCode .dialog1}
21
+ }
22
+
23
+ if {[interp exists child]} {
24
+ interp delete child
25
+ }
evalkit_llava/lib/tk8.6/demos/entry3.tcl ADDED
@@ -0,0 +1,185 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # entry3.tcl --
2
+ #
3
+ # This demonstration script creates several entry widgets whose
4
+ # permitted input is constrained in some way. It also shows off a
5
+ # password entry.
6
+
7
+ if {![info exists widgetDemo]} {
8
+ error "This script should be run from the \"widget\" demo."
9
+ }
10
+
11
+ package require Tk
12
+
13
+ set w .entry3
14
+ catch {destroy $w}
15
+ toplevel $w
16
+ wm title $w "Constrained Entry Demonstration"
17
+ wm iconname $w "entry3"
18
+ positionWindow $w
19
+
20
+ label $w.msg -font $font -wraplength 5i -justify left -text "Four different\
21
+ entries are displayed below. You can add characters by pointing,\
22
+ clicking and typing, though each is constrained in what it will\
23
+ accept. The first only accepts 32-bit integers or the empty string\
24
+ (checking when focus leaves it) and will flash to indicate any\
25
+ problem. The second only accepts strings with fewer than ten\
26
+ characters and sounds the bell when an attempt to go over the limit\
27
+ is made. The third accepts US phone numbers, mapping letters to\
28
+ their digit equivalent and sounding the bell on encountering an\
29
+ illegal character or if trying to type over a character that is not\
30
+ a digit. The fourth is a password field that accepts up to eight\
31
+ characters (silently ignoring further ones), and displaying them as\
32
+ asterisk characters."
33
+
34
+ ## See Code / Dismiss buttons
35
+ set btns [addSeeDismiss $w.buttons $w]
36
+ pack $btns -side bottom -fill x
37
+
38
+ # focusAndFlash --
39
+ # Error handler for entry widgets that forces the focus onto the
40
+ # widget and makes the widget flash by exchanging the foreground and
41
+ # background colours at intervals of 200ms (i.e. at approximately
42
+ # 2.5Hz).
43
+ #
44
+ # Arguments:
45
+ # W - Name of entry widget to flash
46
+ # fg - Initial foreground colour
47
+ # bg - Initial background colour
48
+ # count - Counter to control the number of times flashed
49
+
50
+ proc focusAndFlash {W fg bg {count 9}} {
51
+ focus -force $W
52
+ if {$count<1} {
53
+ $W configure -foreground $fg -background $bg
54
+ } else {
55
+ if {$count%2} {
56
+ $W configure -foreground $bg -background $fg
57
+ } else {
58
+ $W configure -foreground $fg -background $bg
59
+ }
60
+ after 200 [list focusAndFlash $W $fg $bg [expr {$count-1}]]
61
+ }
62
+ }
63
+
64
+ labelframe $w.l1 -text "Integer Entry"
65
+ # Alternatively try using {string is digit} for arbitrary length numbers,
66
+ # and not just 32-bit ones.
67
+ entry $w.l1.e -validate focus -vcmd {string is integer %P}
68
+ $w.l1.e configure -invalidcommand \
69
+ "focusAndFlash %W [$w.l1.e cget -fg] [$w.l1.e cget -bg]"
70
+ pack $w.l1.e -fill x -expand 1 -padx 1m -pady 1m
71
+
72
+ labelframe $w.l2 -text "Length-Constrained Entry"
73
+ entry $w.l2.e -validate key -invcmd bell -vcmd {expr {[string length %P]<10}}
74
+ pack $w.l2.e -fill x -expand 1 -padx 1m -pady 1m
75
+
76
+ ### PHONE NUMBER ENTRY ###
77
+ # Note that the source to this is quite a bit longer as the behaviour
78
+ # demonstrated is a lot more ambitious than with the others.
79
+
80
+ # Initial content for the third entry widget
81
+ set entry3content "1-(000)-000-0000"
82
+ # Mapping from alphabetic characters to numbers. This is probably
83
+ # wrong, but it is the only mapping I have; the UK doesn't really go
84
+ # for associating letters with digits for some reason.
85
+ set phoneNumberMap {}
86
+ foreach {chars digit} {abc 2 def 3 ghi 4 jkl 5 mno 6 pqrs 7 tuv 8 wxyz 9} {
87
+ foreach char [split $chars ""] {
88
+ lappend phoneNumberMap $char $digit [string toupper $char] $digit
89
+ }
90
+ }
91
+
92
+ # validatePhoneChange --
93
+ # Checks that the replacement (mapped to a digit) of the given
94
+ # character in an entry widget at the given position will leave a
95
+ # valid phone number in the widget.
96
+ #
97
+ # W - The entry widget to validate
98
+ # vmode - The widget's validation mode
99
+ # idx - The index where replacement is to occur
100
+ # char - The character (or string, though that will always be
101
+ # refused) to be overwritten at that point.
102
+
103
+ proc validatePhoneChange {W vmode idx char} {
104
+ global phoneNumberMap entry3content
105
+ if {$idx < 0} {return 1}
106
+ after idle [list $W configure -validate $vmode -invcmd bell]
107
+ if {
108
+ !($idx<3 || $idx==6 || $idx==7 || $idx==11 || $idx>15) &&
109
+ [string match {[0-9A-Za-z]} $char]
110
+ } then {
111
+ $W delete $idx
112
+ $W insert $idx [string map $phoneNumberMap $char]
113
+ after idle [list phoneSkipRight $W -1]
114
+ return 1
115
+ }
116
+ return 0
117
+ }
118
+
119
+ # phoneSkipLeft --
120
+ # Skip over fixed characters in a phone-number string when moving left.
121
+ #
122
+ # Arguments:
123
+ # W - The entry widget containing the phone-number.
124
+
125
+ proc phoneSkipLeft {W} {
126
+ set idx [$W index insert]
127
+ if {$idx == 8} {
128
+ # Skip back two extra characters
129
+ $W icursor [incr idx -2]
130
+ } elseif {$idx == 7 || $idx == 12} {
131
+ # Skip back one extra character
132
+ $W icursor [incr idx -1]
133
+ } elseif {$idx <= 3} {
134
+ # Can't move any further
135
+ bell
136
+ return -code break
137
+ }
138
+ }
139
+
140
+ # phoneSkipRight --
141
+ # Skip over fixed characters in a phone-number string when moving right.
142
+ #
143
+ # Arguments:
144
+ # W - The entry widget containing the phone-number.
145
+ # add - Offset to add to index before calculation (used by validation.)
146
+
147
+ proc phoneSkipRight {W {add 0}} {
148
+ set idx [$W index insert]
149
+ if {$idx+$add == 5} {
150
+ # Skip forward two extra characters
151
+ $W icursor [incr idx 2]
152
+ } elseif {$idx+$add == 6 || $idx+$add == 10} {
153
+ # Skip forward one extra character
154
+ $W icursor [incr idx]
155
+ } elseif {$idx+$add == 15 && !$add} {
156
+ # Can't move any further
157
+ bell
158
+ return -code break
159
+ }
160
+ }
161
+
162
+ labelframe $w.l3 -text "US Phone-Number Entry"
163
+ entry $w.l3.e -validate key -invcmd bell -textvariable entry3content \
164
+ -vcmd {validatePhoneChange %W %v %i %S}
165
+ # Click to focus goes to the first editable character...
166
+ bind $w.l3.e <FocusIn> {
167
+ if {"%d" ne "NotifyAncestor"} {
168
+ %W icursor 3
169
+ after idle {%W selection clear}
170
+ }
171
+ }
172
+ bind $w.l3.e <<PrevChar>> {phoneSkipLeft %W}
173
+ bind $w.l3.e <<NextChar>> {phoneSkipRight %W}
174
+ pack $w.l3.e -fill x -expand 1 -padx 1m -pady 1m
175
+
176
+ labelframe $w.l4 -text "Password Entry"
177
+ entry $w.l4.e -validate key -show "*" -vcmd {expr {[string length %P]<=8}}
178
+ pack $w.l4.e -fill x -expand 1 -padx 1m -pady 1m
179
+
180
+ lower [frame $w.mid]
181
+ grid $w.l1 $w.l2 -in $w.mid -padx 3m -pady 1m -sticky ew
182
+ grid $w.l3 $w.l4 -in $w.mid -padx 3m -pady 1m -sticky ew
183
+ grid columnconfigure $w.mid {0 1} -uniform 1
184
+ pack $w.msg -side top
185
+ pack $w.mid -fill both -expand 1
evalkit_llava/lib/tk8.6/demos/fontchoose.tcl ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # fontchoose.tcl --
2
+ #
3
+ # Show off the stock font selector dialog
4
+
5
+ if {![info exists widgetDemo]} {
6
+ error "This script should be run from the \"widget\" demo."
7
+ }
8
+
9
+ package require Tk
10
+
11
+ set w .fontchoose
12
+ catch {destroy $w}
13
+ toplevel $w
14
+ wm title $w "Font Selection Dialog"
15
+ wm iconname $w "fontchooser"
16
+ positionWindow $w
17
+
18
+ catch {font create FontchooseDemoFont {*}[font actual TkDefaultFont]}
19
+
20
+ # The font chooser needs to be configured and then shown.
21
+ proc SelectFont {parent} {
22
+ tk fontchooser configure -font FontchooseDemoFont \
23
+ -command ApplyFont -parent $parent
24
+ tk fontchooser show
25
+ }
26
+
27
+ proc ApplyFont {font} {
28
+ font configure FontchooseDemoFont {*}[font actual $font]
29
+ }
30
+
31
+ # When the visibility of the fontchooser changes, the following event is fired
32
+ # to the parent widget.
33
+ #
34
+ bind $w <<TkFontchooserVisibility>> {
35
+ if {[tk fontchooser configure -visible]} {
36
+ %W.f.font state disabled
37
+ } else {
38
+ %W.f.font state !disabled
39
+ }
40
+ }
41
+
42
+
43
+ set f [ttk::frame $w.f -relief sunken -padding 2]
44
+
45
+ text $f.msg -font FontchooseDemoFont -width 40 -height 6 -borderwidth 0 \
46
+ -yscrollcommand [list $f.vs set]
47
+ ttk::scrollbar $f.vs -command [list $f.msg yview]
48
+
49
+ $f.msg insert end "Press the buttons below to choose a new font for the\
50
+ text shown in this window.\n" {}
51
+
52
+ ttk::button $f.font -text "Set font ..." -command [list SelectFont $w]
53
+
54
+ grid $f.msg $f.vs -sticky news
55
+ grid $f.font - -sticky e
56
+ grid columnconfigure $f 0 -weight 1
57
+ grid rowconfigure $f 0 -weight 1
58
+
59
+ ## See Code / Dismiss buttons
60
+ set btns [addSeeDismiss $w.buttons $w]
61
+
62
+ grid $f -sticky news
63
+ grid $btns -sticky ew
64
+ grid columnconfigure $w 0 -weight 1
65
+ grid rowconfigure $w 0 -weight 1
66
+ update idletasks
67
+ grid propagate $f 0
evalkit_llava/lib/tk8.6/demos/hello ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/sh
2
+ # the next line restarts using wish \
3
+ exec wish8.6 "$0" ${1+"$@"}
4
+
5
+ # hello --
6
+ # Simple Tk script to create a button that prints "Hello, world".
7
+ # Click on the button to terminate the program.
8
+
9
+ package require Tk
10
+
11
+ # The first line below creates the button, and the second line
12
+ # asks the packer to shrink-wrap the application's main window
13
+ # around the button.
14
+
15
+ button .hello -text "Hello, world" -command {
16
+ puts stdout "Hello, world"; destroy .
17
+ }
18
+ pack .hello
19
+
20
+ # Local Variables:
21
+ # mode: tcl
22
+ # End:
evalkit_llava/lib/tk8.6/demos/hscale.tcl ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # hscale.tcl --
2
+ #
3
+ # This demonstration script shows an example with a horizontal scale.
4
+
5
+ if {![info exists widgetDemo]} {
6
+ error "This script should be run from the \"widget\" demo."
7
+ }
8
+
9
+ package require Tk
10
+
11
+ set w .hscale
12
+ catch {destroy $w}
13
+ toplevel $w
14
+ wm title $w "Horizontal Scale Demonstration"
15
+ wm iconname $w "hscale"
16
+ positionWindow $w
17
+
18
+ label $w.msg -font $font -wraplength 3.5i -justify left -text "An arrow and a horizontal scale are displayed below. If you click or drag mouse button 1 in the scale, you can change the length of the arrow."
19
+ pack $w.msg -side top -padx .5c
20
+
21
+ ## See Code / Dismiss buttons
22
+ set btns [addSeeDismiss $w.buttons $w]
23
+ pack $btns -side bottom -fill x
24
+
25
+ frame $w.frame -borderwidth 10
26
+ pack $w.frame -side top -fill x
27
+
28
+ canvas $w.frame.canvas -width 50 -height 50 -bd 0 -highlightthickness 0
29
+ $w.frame.canvas create polygon 0 0 1 1 2 2 -fill DeepSkyBlue3 -tags poly
30
+ $w.frame.canvas create line 0 0 1 1 2 2 0 0 -fill black -tags line
31
+ scale $w.frame.scale -orient horizontal -length 284 -from 0 -to 250 \
32
+ -command "setWidth $w.frame.canvas" -tickinterval 50
33
+ pack $w.frame.canvas -side top -expand yes -anchor s -fill x -padx 15
34
+ pack $w.frame.scale -side bottom -expand yes -anchor n
35
+ $w.frame.scale set 75
36
+
37
+ proc setWidth {w width} {
38
+ incr width 21
39
+ set x2 [expr {$width - 30}]
40
+ if {$x2 < 21} {
41
+ set x2 21
42
+ }
43
+ $w coords poly 20 15 20 35 $x2 35 $x2 45 $width 25 $x2 5 $x2 15 20 15
44
+ $w coords line 20 15 20 35 $x2 35 $x2 45 $width 25 $x2 5 $x2 15 20 15
45
+ }
evalkit_llava/lib/tk8.6/demos/image2.tcl ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # image2.tcl --
2
+ #
3
+ # This demonstration script creates a simple collection of widgets
4
+ # that allow you to select and view images in a Tk label.
5
+
6
+ if {![info exists widgetDemo]} {
7
+ error "This script should be run from the \"widget\" demo."
8
+ }
9
+
10
+ package require Tk
11
+
12
+ # loadDir --
13
+ # This procedure reloads the directory listbox from the directory
14
+ # named in the demo's entry.
15
+ #
16
+ # Arguments:
17
+ # w - Name of the toplevel window of the demo.
18
+
19
+ proc loadDir w {
20
+ global dirName
21
+
22
+ $w.f.list delete 0 end
23
+ foreach i [lsort [glob -type f -directory $dirName *]] {
24
+ $w.f.list insert end [file tail $i]
25
+ }
26
+ }
27
+
28
+ # selectAndLoadDir --
29
+ # This procedure pops up a dialog to ask for a directory to load into
30
+ # the listobx and (if the user presses OK) reloads the directory
31
+ # listbox from the directory named in the demo's entry.
32
+ #
33
+ # Arguments:
34
+ # w - Name of the toplevel window of the demo.
35
+
36
+ proc selectAndLoadDir w {
37
+ global dirName
38
+ set dir [tk_chooseDirectory -initialdir $dirName -parent $w -mustexist 1]
39
+ if {$dir ne ""} {
40
+ set dirName $dir
41
+ loadDir $w
42
+ }
43
+ }
44
+
45
+ # loadImage --
46
+ # Given the name of the toplevel window of the demo and the mouse
47
+ # position, extracts the directory entry under the mouse and loads
48
+ # that file into a photo image for display.
49
+ #
50
+ # Arguments:
51
+ # w - Name of the toplevel window of the demo.
52
+ # x, y- Mouse position within the listbox.
53
+
54
+ proc loadImage {w x y} {
55
+ global dirName
56
+
57
+ set file [file join $dirName [$w.f.list get @$x,$y]]
58
+ if {[catch {
59
+ image2a configure -file $file
60
+ }]} then {
61
+ # Mark the file as not loadable
62
+ $w.f.list itemconfigure @$x,$y -bg \#c00000 -selectbackground \#ff0000
63
+ }
64
+ }
65
+
66
+ set w .image2
67
+ catch {destroy $w}
68
+ toplevel $w
69
+ wm title $w "Image Demonstration #2"
70
+ wm iconname $w "Image2"
71
+ positionWindow $w
72
+
73
+ label $w.msg -font $font -wraplength 4i -justify left -text "This demonstration allows you to view images using a Tk \"photo\" image. First type a directory name in the listbox, then type Return to load the directory into the listbox. Then double-click on a file name in the listbox to see that image."
74
+ pack $w.msg -side top
75
+
76
+ ## See Code / Dismiss buttons
77
+ set btns [addSeeDismiss $w.buttons $w]
78
+ pack $btns -side bottom -fill x
79
+
80
+ frame $w.mid
81
+ pack $w.mid -fill both -expand 1
82
+
83
+ labelframe $w.dir -text "Directory:"
84
+ # Main widget program sets variable tk_demoDirectory
85
+ set dirName [file join $tk_demoDirectory images]
86
+ entry $w.dir.e -width 30 -textvariable dirName
87
+ button $w.dir.b -pady 0 -padx 2m -text "Select Dir." \
88
+ -command "selectAndLoadDir $w"
89
+ bind $w.dir.e <Return> "loadDir $w"
90
+ pack $w.dir.e -side left -fill both -padx 2m -pady 2m -expand true
91
+ pack $w.dir.b -side left -fill y -padx {0 2m} -pady 2m
92
+ labelframe $w.f -text "File:" -padx 2m -pady 2m
93
+
94
+ listbox $w.f.list -width 20 -height 10 -yscrollcommand "$w.f.scroll set"
95
+ ttk::scrollbar $w.f.scroll -command "$w.f.list yview"
96
+ pack $w.f.list $w.f.scroll -side left -fill y -expand 1
97
+ $w.f.list insert 0 earth.gif earthris.gif teapot.ppm
98
+ bind $w.f.list <Double-Button-1> "loadImage $w %x %y"
99
+
100
+ catch {image delete image2a}
101
+ image create photo image2a
102
+ labelframe $w.image -text "Image:"
103
+ label $w.image.image -image image2a
104
+ pack $w.image.image -padx 2m -pady 2m
105
+
106
+ grid $w.dir - -sticky ew -padx 1m -pady 1m -in $w.mid
107
+ grid $w.f $w.image -sticky nw -padx 1m -pady 1m -in $w.mid
108
+ grid columnconfigure $w.mid 1 -weight 1
evalkit_llava/lib/tk8.6/demos/images/flagdown.xbm ADDED
evalkit_llava/lib/tk8.6/demos/images/flagup.xbm ADDED
evalkit_llava/lib/tk8.6/demos/images/gray25.xbm ADDED
evalkit_llava/lib/tk8.6/demos/images/letters.xbm ADDED
evalkit_llava/lib/tk8.6/demos/images/noletter.xbm ADDED
evalkit_llava/lib/tk8.6/demos/images/pattern.xbm ADDED
evalkit_llava/lib/tk8.6/demos/items.tcl ADDED
@@ -0,0 +1,302 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # items.tcl --
2
+ #
3
+ # This demonstration script creates a canvas that displays the
4
+ # canvas item types.
5
+
6
+ if {![info exists widgetDemo]} {
7
+ error "This script should be run from the \"widget\" demo."
8
+ }
9
+
10
+ package require Tk
11
+
12
+ set w .items
13
+ catch {destroy $w}
14
+ toplevel $w
15
+ wm title $w "Canvas Item Demonstration"
16
+ wm iconname $w "Items"
17
+ positionWindow $w
18
+ set c $w.frame.c
19
+
20
+ label $w.msg -font $font -wraplength 5i -justify left -text "This window contains a canvas widget with examples of the various kinds of items supported by canvases. The following operations are supported:\n Left-Button drag:\tmoves item under pointer.\n Middle-Button drag:\trepositions view.\n Right-Button drag:\tstrokes out area.\n Ctrl+f:\t\tprints items under area."
21
+ pack $w.msg -side top
22
+
23
+ ## See Code / Dismiss buttons
24
+ set btns [addSeeDismiss $w.buttons $w]
25
+ pack $btns -side bottom -fill x
26
+
27
+ frame $w.frame
28
+ pack $w.frame -side top -fill both -expand yes
29
+
30
+ canvas $c -scrollregion {0c 0c 30c 24c} -width 15c -height 10c \
31
+ -relief sunken -borderwidth 2 \
32
+ -xscrollcommand "$w.frame.hscroll set" \
33
+ -yscrollcommand "$w.frame.vscroll set"
34
+ ttk::scrollbar $w.frame.vscroll -command "$c yview"
35
+ ttk::scrollbar $w.frame.hscroll -orient horizontal -command "$c xview"
36
+
37
+ grid $c -in $w.frame \
38
+ -row 0 -column 0 -rowspan 1 -columnspan 1 -sticky news
39
+ grid $w.frame.vscroll \
40
+ -row 0 -column 1 -rowspan 1 -columnspan 1 -sticky news
41
+ grid $w.frame.hscroll \
42
+ -row 1 -column 0 -rowspan 1 -columnspan 1 -sticky news
43
+ grid rowconfig $w.frame 0 -weight 1 -minsize 0
44
+ grid columnconfig $w.frame 0 -weight 1 -minsize 0
45
+
46
+ # Display a 3x3 rectangular grid.
47
+
48
+ $c create rect 0c 0c 30c 24c -width 2
49
+ $c create line 0c 8c 30c 8c -width 2
50
+ $c create line 0c 16c 30c 16c -width 2
51
+ $c create line 10c 0c 10c 24c -width 2
52
+ $c create line 20c 0c 20c 24c -width 2
53
+
54
+ set font1 {Helvetica 12}
55
+ set font2 {Helvetica 24 bold}
56
+ if {[winfo depth $c] > 1} {
57
+ set blue DeepSkyBlue3
58
+ set red red
59
+ set bisque bisque3
60
+ set green SeaGreen3
61
+ } else {
62
+ set blue black
63
+ set red black
64
+ set bisque black
65
+ set green black
66
+ }
67
+
68
+ # Set up demos within each of the areas of the grid.
69
+
70
+ $c create text 5c .2c -text Lines -anchor n
71
+ $c create line 1c 1c 3c 1c 1c 4c 3c 4c -width 2m -fill $blue \
72
+ -cap butt -join miter -tags item
73
+ $c create line 4.67c 1c 4.67c 4c -arrow last -tags item
74
+ $c create line 6.33c 1c 6.33c 4c -arrow both -tags item
75
+ $c create line 5c 6c 9c 6c 9c 1c 8c 1c 8c 4.8c 8.8c 4.8c 8.8c 1.2c \
76
+ 8.2c 1.2c 8.2c 4.6c 8.6c 4.6c 8.6c 1.4c 8.4c 1.4c 8.4c 4.4c \
77
+ -width 3 -fill $red -tags item
78
+ # Main widget program sets variable tk_demoDirectory
79
+ $c create line 1c 5c 7c 5c 7c 7c 9c 7c -width .5c \
80
+ -stipple @[file join $tk_demoDirectory images gray25.xbm] \
81
+ -arrow both -arrowshape {15 15 7} -tags item
82
+ $c create line 1c 7c 1.75c 5.8c 2.5c 7c 3.25c 5.8c 4c 7c -width .5c \
83
+ -cap round -join round -tags item
84
+
85
+ $c create text 15c .2c -text "Curves (smoothed lines)" -anchor n
86
+ $c create line 11c 4c 11.5c 1c 13.5c 1c 14c 4c -smooth on \
87
+ -fill $blue -tags item
88
+ $c create line 15.5c 1c 19.5c 1.5c 15.5c 4.5c 19.5c 4c -smooth on \
89
+ -arrow both -width 3 -tags item
90
+ $c create line 12c 6c 13.5c 4.5c 16.5c 7.5c 18c 6c \
91
+ 16.5c 4.5c 13.5c 7.5c 12c 6c -smooth on -width 3m -cap round \
92
+ -stipple @[file join $tk_demoDirectory images gray25.xbm] \
93
+ -fill $red -tags item
94
+
95
+ $c create text 25c .2c -text Polygons -anchor n
96
+ $c create polygon 21c 1.0c 22.5c 1.75c 24c 1.0c 23.25c 2.5c \
97
+ 24c 4.0c 22.5c 3.25c 21c 4.0c 21.75c 2.5c -fill $green \
98
+ -outline {} -width 4 -tags item
99
+ $c create polygon 25c 4c 25c 4c 25c 1c 26c 1c 27c 4c 28c 1c \
100
+ 29c 1c 29c 4c 29c 4c -fill $red -outline {} -smooth on -tags item
101
+ $c create polygon 22c 4.5c 25c 4.5c 25c 6.75c 28c 6.75c \
102
+ 28c 5.25c 24c 5.25c 24c 6.0c 26c 6c 26c 7.5c 22c 7.5c \
103
+ -stipple @[file join $tk_demoDirectory images gray25.xbm] \
104
+ -fill $blue -outline {} -tags item
105
+
106
+ $c create text 5c 8.2c -text Rectangles -anchor n
107
+ $c create rectangle 1c 9.5c 4c 12.5c -outline $red -width 3m -tags item
108
+ $c create rectangle 0.5c 13.5c 4.5c 15.5c -fill $green -tags item
109
+ $c create rectangle 6c 10c 9c 15c -outline {} \
110
+ -stipple @[file join $tk_demoDirectory images gray25.xbm] \
111
+ -fill $blue -tags item
112
+
113
+ $c create text 15c 8.2c -text Ovals -anchor n
114
+ $c create oval 11c 9.5c 14c 12.5c -outline $red -width 3m -tags item
115
+ $c create oval 10.5c 13.5c 14.5c 15.5c -fill $green -tags item
116
+ $c create oval 16c 10c 19c 15c -outline {} \
117
+ -stipple @[file join $tk_demoDirectory images gray25.xbm] \
118
+ -fill $blue -tags item
119
+
120
+ $c create text 25c 8.2c -text Text -anchor n
121
+ $c create rectangle 22.4c 8.9c 22.6c 9.1c
122
+ $c create text 22.5c 9c -anchor n -font $font1 -width 4c \
123
+ -text "A short string of text, word-wrapped, justified left, and anchored north (at the top). The rectangles show the anchor points for each piece of text." -tags item
124
+ $c create rectangle 25.4c 10.9c 25.6c 11.1c
125
+ $c create text 25.5c 11c -anchor w -font $font1 -fill $blue \
126
+ -text "Several lines,\n each centered\nindividually,\nand all anchored\nat the left edge." \
127
+ -justify center -tags item
128
+ $c create rectangle 24.9c 13.9c 25.1c 14.1c
129
+ catch {
130
+ $c create text 25c 14c -font $font2 -anchor c -fill $red -angle 15 \
131
+ -text "Angled characters" -tags item
132
+ }
133
+
134
+ $c create text 5c 16.2c -text Arcs -anchor n
135
+ $c create arc 0.5c 17c 7c 20c -fill $green -outline black \
136
+ -start 45 -extent 270 -style pieslice -tags item
137
+ $c create arc 6.5c 17c 9.5c 20c -width 4m -style arc \
138
+ -outline $blue -start -135 -extent 270 -tags item \
139
+ -outlinestipple @[file join $tk_demoDirectory images gray25.xbm]
140
+ $c create arc 0.5c 20c 9.5c 24c -width 4m -style pieslice \
141
+ -fill {} -outline $red -start 225 -extent -90 -tags item
142
+ $c create arc 5.5c 20.5c 9.5c 23.5c -width 4m -style chord \
143
+ -fill $blue -outline {} -start 45 -extent 270 -tags item
144
+
145
+ $c create text 15c 16.2c -text "Bitmaps and Images" -anchor n
146
+ catch {
147
+ image create photo items.ousterhout \
148
+ -file [file join $tk_demoDirectory images ouster.png]
149
+ image create photo items.ousterhout.active -format "png -alpha 0.5" \
150
+ -file [file join $tk_demoDirectory images ouster.png]
151
+ $c create image 13c 20c -tags item -image items.ousterhout \
152
+ -activeimage items.ousterhout.active
153
+ }
154
+ $c create bitmap 17c 18.5c -tags item \
155
+ -bitmap @[file join $tk_demoDirectory images noletter.xbm]
156
+ $c create bitmap 17c 21.5c -tags item \
157
+ -bitmap @[file join $tk_demoDirectory images letters.xbm]
158
+
159
+ $c create text 25c 16.2c -text Windows -anchor n
160
+ button $c.button -text "Press Me" -command "butPress $c $red"
161
+ $c create window 21c 18c -window $c.button -anchor nw -tags item
162
+ entry $c.entry -width 20 -relief sunken
163
+ $c.entry insert end "Edit this text"
164
+ $c create window 21c 21c -window $c.entry -anchor nw -tags item
165
+ scale $c.scale -from 0 -to 100 -length 6c -sliderlength .4c \
166
+ -width .5c -tickinterval 0
167
+ $c create window 28.5c 17.5c -window $c.scale -anchor n -tags item
168
+ $c create text 21c 17.9c -text Button: -anchor sw
169
+ $c create text 21c 20.9c -text Entry: -anchor sw
170
+ $c create text 28.5c 17.4c -text Scale: -anchor s
171
+
172
+ # Set up event bindings for canvas:
173
+
174
+ $c bind item <Enter> "itemEnter $c"
175
+ $c bind item <Leave> "itemLeave $c"
176
+ if {[tk windowingsystem] eq "aqua" && ![package vsatisfies [package provide Tk] 8.7-]} {
177
+ bind $c <Button-2> "itemMark $c %x %y"
178
+ bind $c <B2-Motion> "itemStroke $c %x %y"
179
+ bind $c <Button-3> "$c scan mark %x %y"
180
+ bind $c <B3-Motion> "$c scan dragto %x %y"
181
+ } else {
182
+ bind $c <Button-2> "$c scan mark %x %y"
183
+ bind $c <B2-Motion> "$c scan dragto %x %y"
184
+ bind $c <Button-3> "itemMark $c %x %y"
185
+ bind $c <B3-Motion> "itemStroke $c %x %y"
186
+ }
187
+ bind $c <<NextChar>> "itemsUnderArea $c"
188
+ bind $c <Button-1> "itemStartDrag $c %x %y"
189
+ bind $c <B1-Motion> "itemDrag $c %x %y"
190
+
191
+ # Utility procedures for highlighting the item under the pointer:
192
+
193
+ proc itemEnter {c} {
194
+ global restoreCmd
195
+
196
+ if {[winfo depth $c] == 1} {
197
+ set restoreCmd {}
198
+ return
199
+ }
200
+ set type [$c type current]
201
+ if {$type == "window" || $type == "image"} {
202
+ set restoreCmd {}
203
+ return
204
+ } elseif {$type == "bitmap"} {
205
+ set bg [lindex [$c itemconf current -background] 4]
206
+ set restoreCmd [list $c itemconfig current -background $bg]
207
+ $c itemconfig current -background SteelBlue2
208
+ return
209
+ } elseif {$type == "image"} {
210
+ set restoreCmd [list $c itemconfig current -state normal]
211
+ $c itemconfig current -state active
212
+ return
213
+ }
214
+ set fill [lindex [$c itemconfig current -fill] 4]
215
+ if {(($type == "rectangle") || ($type == "oval") || ($type == "arc"))
216
+ && ($fill == "")} {
217
+ set outline [lindex [$c itemconfig current -outline] 4]
218
+ set restoreCmd "$c itemconfig current -outline $outline"
219
+ $c itemconfig current -outline SteelBlue2
220
+ } else {
221
+ set restoreCmd "$c itemconfig current -fill $fill"
222
+ $c itemconfig current -fill SteelBlue2
223
+ }
224
+ }
225
+
226
+ proc itemLeave {c} {
227
+ global restoreCmd
228
+
229
+ eval $restoreCmd
230
+ }
231
+
232
+ # Utility procedures for stroking out a rectangle and printing what's
233
+ # underneath the rectangle's area.
234
+
235
+ proc itemMark {c x y} {
236
+ global areaX1 areaY1
237
+ set areaX1 [$c canvasx $x]
238
+ set areaY1 [$c canvasy $y]
239
+ $c delete area
240
+ }
241
+
242
+ proc itemStroke {c x y} {
243
+ global areaX1 areaY1 areaX2 areaY2
244
+ set x [$c canvasx $x]
245
+ set y [$c canvasy $y]
246
+ if {($areaX1 != $x) && ($areaY1 != $y)} {
247
+ $c delete area
248
+ $c addtag area withtag [$c create rect $areaX1 $areaY1 $x $y \
249
+ -outline black]
250
+ set areaX2 $x
251
+ set areaY2 $y
252
+ }
253
+ }
254
+
255
+ proc itemsUnderArea {c} {
256
+ global areaX1 areaY1 areaX2 areaY2
257
+ set area [$c find withtag area]
258
+ set items ""
259
+ foreach i [$c find enclosed $areaX1 $areaY1 $areaX2 $areaY2] {
260
+ if {[lsearch [$c gettags $i] item] >= 0} {
261
+ lappend items $i
262
+ }
263
+ }
264
+ puts stdout "Items enclosed by area: $items"
265
+ set items ""
266
+ foreach i [$c find overlapping $areaX1 $areaY1 $areaX2 $areaY2] {
267
+ if {[lsearch [$c gettags $i] item] >= 0} {
268
+ lappend items $i
269
+ }
270
+ }
271
+ puts stdout "Items overlapping area: $items"
272
+ }
273
+
274
+ set areaX1 0
275
+ set areaY1 0
276
+ set areaX2 0
277
+ set areaY2 0
278
+
279
+ # Utility procedures to support dragging of items.
280
+
281
+ proc itemStartDrag {c x y} {
282
+ global lastX lastY
283
+ set lastX [$c canvasx $x]
284
+ set lastY [$c canvasy $y]
285
+ }
286
+
287
+ proc itemDrag {c x y} {
288
+ global lastX lastY
289
+ set x [$c canvasx $x]
290
+ set y [$c canvasy $y]
291
+ $c move current [expr {$x-$lastX}] [expr {$y-$lastY}]
292
+ set lastX $x
293
+ set lastY $y
294
+ }
295
+
296
+ # Procedure that's invoked when the button embedded in the canvas
297
+ # is invoked.
298
+
299
+ proc butPress {w color} {
300
+ set i [$w create text 25c 18.1c -text "Oooohhh!!" -fill $color -anchor n]
301
+ after 500 "$w delete $i"
302
+ }
evalkit_llava/lib/tk8.6/demos/ixset ADDED
@@ -0,0 +1,328 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/sh
2
+ # the next line restarts using wish \
3
+ exec wish8.6 "$0" ${1+"$@"}
4
+
5
+ # ixset --
6
+ # A nice interface to "xset" to change X server settings
7
+ #
8
+ # History :
9
+ # 91/11/23 : [email protected], [email protected] : design
10
+ # 92/08/01 : [email protected] : cleaning
11
+
12
+ package require Tk
13
+
14
+ #
15
+ # Button actions
16
+ #
17
+
18
+ proc quit {} {
19
+ destroy .
20
+ }
21
+
22
+ proc ok {} {
23
+ writesettings
24
+ quit
25
+ }
26
+
27
+ proc cancel {} {
28
+ readsettings
29
+ dispsettings
30
+ .buttons.apply configure -state disabled
31
+ .buttons.cancel configure -state disabled
32
+ }
33
+
34
+ proc apply {} {
35
+ writesettings
36
+ .buttons.apply configure -state disabled
37
+ .buttons.cancel configure -state disabled
38
+ }
39
+
40
+ #
41
+ # Read current settings
42
+ #
43
+
44
+ proc readsettings {} {
45
+ global kbdrep ; set kbdrep "on"
46
+ global kbdcli ; set kbdcli 0
47
+ global bellvol ; set bellvol 100
48
+ global bellpit ; set bellpit 440
49
+ global belldur ; set belldur 100
50
+ global mouseacc ; set mouseacc "3/1"
51
+ global mousethr ; set mousethr 4
52
+ global screenbla ; set screenbla "blank"
53
+ global screentim ; set screentim 600
54
+ global screencyc ; set screencyc 600
55
+
56
+ set xfd [open "|xset q" r]
57
+ while {[gets $xfd line] >= 0} {
58
+ switch -- [lindex $line 0] {
59
+ auto {
60
+ set rpt [lindex $line 1]
61
+ if {$rpt eq "repeat:"} {
62
+ set kbdrep [lindex $line 2]
63
+ set kbdcli [lindex $line 6]
64
+ }
65
+ }
66
+ bell {
67
+ set bellvol [lindex $line 2]
68
+ set bellpit [lindex $line 5]
69
+ set belldur [lindex $line 8]
70
+ }
71
+ acceleration: {
72
+ set mouseacc [lindex $line 1]
73
+ set mousethr [lindex $line 3]
74
+ }
75
+ prefer {
76
+ set bla [lindex $line 2]
77
+ set screenbla [expr {$bla eq "yes" ? "blank" : "noblank"}]
78
+ }
79
+ timeout: {
80
+ set screentim [lindex $line 1]
81
+ set screencyc [lindex $line 3]
82
+ }
83
+ }
84
+ }
85
+ close $xfd
86
+
87
+ # puts stdout [format "Key REPEAT = %s\n" $kbdrep]
88
+ # puts stdout [format "Key CLICK = %s\n" $kbdcli]
89
+ # puts stdout [format "Bell VOLUME = %s\n" $bellvol]
90
+ # puts stdout [format "Bell PITCH = %s\n" $bellpit]
91
+ # puts stdout [format "Bell DURATION = %s\n" $belldur]
92
+ # puts stdout [format "Mouse ACCELERATION = %s\n" $mouseacc]
93
+ # puts stdout [format "Mouse THRESHOLD = %s\n" $mousethr]
94
+ # puts stdout [format "Screen BLANCK = %s\n" $screenbla]
95
+ # puts stdout [format "Screen TIMEOUT = %s\n" $screentim]
96
+ # puts stdout [format "Screen CYCLE = %s\n" $screencyc]
97
+ }
98
+
99
+
100
+ #
101
+ # Write settings into the X server
102
+ #
103
+
104
+ proc writesettings {} {
105
+ global kbdrep kbdcli bellvol bellpit belldur
106
+ global mouseacc mousethr screenbla screentim screencyc
107
+
108
+ set bellvol [.bell.vol get]
109
+ set bellpit [.bell.val.pit.entry get]
110
+ set belldur [.bell.val.dur.entry get]
111
+
112
+ if {$kbdrep eq "on"} {
113
+ set kbdcli [.kbd.val.cli get]
114
+ } else {
115
+ set kbdcli "off"
116
+ }
117
+
118
+ set mouseacc [.mouse.hor.acc.entry get]
119
+ set mousethr [.mouse.hor.thr.entry get]
120
+
121
+ set screentim [.screen.tim.entry get]
122
+ set screencyc [.screen.cyc.entry get]
123
+
124
+ exec xset \
125
+ b $bellvol $bellpit $belldur \
126
+ c $kbdcli \
127
+ r $kbdrep \
128
+ m $mouseacc $mousethr \
129
+ s $screentim $screencyc \
130
+ s $screenbla
131
+ }
132
+
133
+
134
+ #
135
+ # Sends all settings to the window
136
+ #
137
+
138
+ proc dispsettings {} {
139
+ global kbdrep kbdcli bellvol bellpit belldur
140
+ global mouseacc mousethr screenbla screentim screencyc
141
+
142
+ .bell.vol set $bellvol
143
+ .bell.val.pit.entry delete 0 end
144
+ .bell.val.pit.entry insert 0 $bellpit
145
+ .bell.val.dur.entry delete 0 end
146
+ .bell.val.dur.entry insert 0 $belldur
147
+
148
+ .kbd.val.onoff [expr {$kbdrep eq "on" ? "select" : "deselect"}]
149
+ .kbd.val.cli set $kbdcli
150
+
151
+ .mouse.hor.acc.entry delete 0 end
152
+ .mouse.hor.acc.entry insert 0 $mouseacc
153
+ .mouse.hor.thr.entry delete 0 end
154
+ .mouse.hor.thr.entry insert 0 $mousethr
155
+
156
+ .screen.blank [expr {$screenbla eq "blank" ? "select" : "deselect"}]
157
+ .screen.pat [expr {$screenbla ne "blank" ? "select" : "deselect"}]
158
+ .screen.tim.entry delete 0 end
159
+ .screen.tim.entry insert 0 $screentim
160
+ .screen.cyc.entry delete 0 end
161
+ .screen.cyc.entry insert 0 $screencyc
162
+ }
163
+
164
+
165
+ #
166
+ # Create all windows, and pack them
167
+ #
168
+
169
+ proc labelentry {path text length {range {}}} {
170
+ frame $path
171
+ label $path.label -text $text
172
+ if {[llength $range]} {
173
+ spinbox $path.entry -width $length -relief sunken \
174
+ -from [lindex $range 0] -to [lindex $range 1]
175
+ } else {
176
+ entry $path.entry -width $length -relief sunken
177
+ }
178
+ pack $path.label -side left
179
+ pack $path.entry -side right -expand y -fill x
180
+ }
181
+
182
+ proc createwindows {} {
183
+ #
184
+ # Buttons
185
+ #
186
+
187
+ frame .buttons
188
+ button .buttons.ok -default active -command ok -text "Ok"
189
+ button .buttons.apply -default normal -command apply -text "Apply" \
190
+ -state disabled
191
+ button .buttons.cancel -default normal -command cancel -text "Cancel" \
192
+ -state disabled
193
+ button .buttons.quit -default normal -command quit -text "Quit"
194
+
195
+ pack .buttons.ok .buttons.apply .buttons.cancel .buttons.quit \
196
+ -side left -expand yes -pady 5
197
+
198
+ bind . <Return> {.buttons.ok flash; .buttons.ok invoke}
199
+ bind . <Escape> {.buttons.quit flash; .buttons.quit invoke}
200
+ bind . <Button-1> {
201
+ if {![string match .buttons* %W]} {
202
+ .buttons.apply configure -state normal
203
+ .buttons.cancel configure -state normal
204
+ }
205
+ }
206
+ bind . <Key> {
207
+ if {![string match .buttons* %W]} {
208
+ switch -glob %K {
209
+ Return - Escape - Tab - *Shift* {}
210
+ default {
211
+ .buttons.apply configure -state normal
212
+ .buttons.cancel configure -state normal
213
+ }
214
+ }
215
+ }
216
+ }
217
+
218
+ #
219
+ # Bell settings
220
+ #
221
+
222
+ labelframe .bell -text "Bell Settings" -padx 1.5m -pady 1.5m
223
+ scale .bell.vol \
224
+ -from 0 -to 100 -length 200 -tickinterval 20 \
225
+ -label "Volume (%)" -orient horizontal
226
+
227
+ frame .bell.val
228
+ labelentry .bell.val.pit "Pitch (Hz)" 6 {25 20000}
229
+ labelentry .bell.val.dur "Duration (ms)" 6 {1 10000}
230
+ pack .bell.val.pit -side left -padx 5
231
+ pack .bell.val.dur -side right -padx 5
232
+ pack .bell.vol .bell.val -side top -expand yes
233
+
234
+ #
235
+ # Keyboard settings
236
+ #
237
+
238
+ labelframe .kbd -text "Keyboard Repeat Settings" -padx 1.5m -pady 1.5m
239
+
240
+ frame .kbd.val
241
+ checkbutton .kbd.val.onoff \
242
+ -text "On" \
243
+ -onvalue "on" -offvalue "off" -variable kbdrep \
244
+ -relief flat
245
+ scale .kbd.val.cli \
246
+ -from 0 -to 100 -length 200 -tickinterval 20 \
247
+ -label "Click Volume (%)" -orient horizontal
248
+ pack .kbd.val.onoff -side left -fill x -expand yes -padx {0 1m}
249
+ pack .kbd.val.cli -side left -expand yes -fill x -padx {1m 0}
250
+
251
+ pack .kbd.val -side top -expand yes -pady 2 -fill x
252
+
253
+ #
254
+ # Mouse settings
255
+ #
256
+
257
+ labelframe .mouse -text "Mouse Settings" -padx 1.5m -pady 1.5m
258
+
259
+ frame .mouse.hor
260
+ labelentry .mouse.hor.acc "Acceleration" 5
261
+ labelentry .mouse.hor.thr "Threshold (pixels)" 3 {1 2000}
262
+
263
+ pack .mouse.hor.acc -side left -padx {0 1m}
264
+ pack .mouse.hor.thr -side right -padx {1m 0}
265
+
266
+ pack .mouse.hor -side top -expand yes
267
+
268
+ #
269
+ # Screen Saver settings
270
+ #
271
+
272
+ labelframe .screen -text "Screen-saver Settings" -padx 1.5m -pady 1.5m
273
+
274
+ radiobutton .screen.blank \
275
+ -variable screenblank -text "Blank" -relief flat \
276
+ -value "blank" -variable screenbla -anchor w
277
+ radiobutton .screen.pat \
278
+ -variable screenblank -text "Pattern" -relief flat \
279
+ -value "noblank" -variable screenbla -anchor w
280
+ labelentry .screen.tim "Timeout (s)" 5 {1 100000}
281
+ labelentry .screen.cyc "Cycle (s)" 5 {1 100000}
282
+
283
+ grid .screen.blank .screen.tim -sticky e
284
+ grid .screen.pat .screen.cyc -sticky e
285
+ grid configure .screen.blank .screen.pat -sticky ew
286
+
287
+ #
288
+ # Main window
289
+ #
290
+
291
+ pack .buttons -side top -fill both
292
+ pack .bell .kbd .mouse .screen -side top -fill both -expand yes \
293
+ -padx 1m -pady 1m
294
+
295
+ #
296
+ # Let the user resize our window
297
+ #
298
+ wm minsize . 10 10
299
+ }
300
+
301
+ ##############################################################################
302
+ # Main program
303
+
304
+ #
305
+ # Listen what "xset" tells us...
306
+ #
307
+
308
+ readsettings
309
+
310
+ #
311
+ # Create all windows
312
+ #
313
+
314
+ createwindows
315
+
316
+ #
317
+ # Write xset parameters
318
+ #
319
+
320
+ dispsettings
321
+
322
+ #
323
+ # Now, wait for user actions...
324
+ #
325
+
326
+ # Local Variables:
327
+ # mode: tcl
328
+ # End:
evalkit_llava/lib/tk8.6/demos/label.tcl ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # label.tcl --
2
+ #
3
+ # This demonstration script creates a toplevel window containing
4
+ # several label widgets.
5
+
6
+ if {![info exists widgetDemo]} {
7
+ error "This script should be run from the \"widget\" demo."
8
+ }
9
+
10
+ package require Tk
11
+
12
+ set w .label
13
+ catch {destroy $w}
14
+ toplevel $w
15
+ wm title $w "Label Demonstration"
16
+ wm iconname $w "label"
17
+ positionWindow $w
18
+
19
+ label $w.msg -font $font -wraplength 4i -justify left -text "Five labels are displayed below: three textual ones on the left, and an image label and a text label on the right. Labels are pretty boring because you can't do anything with them."
20
+ pack $w.msg -side top
21
+
22
+ ## See Code / Dismiss buttons
23
+ set btns [addSeeDismiss $w.buttons $w]
24
+ pack $btns -side bottom -fill x
25
+
26
+ frame $w.left
27
+ frame $w.right
28
+ pack $w.left $w.right -side left -expand yes -padx 10 -pady 10 -fill both
29
+
30
+ label $w.left.l1 -text "First label"
31
+ label $w.left.l2 -text "Second label, raised" -relief raised
32
+ label $w.left.l3 -text "Third label, sunken" -relief sunken
33
+ pack $w.left.l1 $w.left.l2 $w.left.l3 -side top -expand yes -pady 2 -anchor w
34
+
35
+ # Main widget program sets variable tk_demoDirectory
36
+ image create photo label.ousterhout \
37
+ -file [file join $tk_demoDirectory images ouster.png]
38
+ label $w.right.picture -borderwidth 2 -relief sunken -image label.ousterhout
39
+ label $w.right.caption -text "Tcl/Tk Creator"
40
+ pack $w.right.picture $w.right.caption -side top
evalkit_llava/lib/tk8.6/demos/labelframe.tcl ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # labelframe.tcl --
2
+ #
3
+ # This demonstration script creates a toplevel window containing
4
+ # several labelframe widgets.
5
+
6
+ if {![info exists widgetDemo]} {
7
+ error "This script should be run from the \"widget\" demo."
8
+ }
9
+
10
+ package require Tk
11
+
12
+ set w .labelframe
13
+ catch {destroy $w}
14
+ toplevel $w
15
+ wm title $w "Labelframe Demonstration"
16
+ wm iconname $w "labelframe"
17
+ positionWindow $w
18
+
19
+ # Some information
20
+
21
+ label $w.msg -font $font -wraplength 4i -justify left -text "Labelframes are\
22
+ used to group related widgets together. The label may be either \
23
+ plain text or another widget."
24
+ pack $w.msg -side top
25
+
26
+ ## See Code / Dismiss buttons
27
+ set btns [addSeeDismiss $w.buttons $w]
28
+ pack $btns -side bottom -fill x
29
+
30
+ # Demo area
31
+
32
+ frame $w.f
33
+ pack $w.f -side bottom -fill both -expand 1
34
+ set w $w.f
35
+
36
+ # A group of radiobuttons in a labelframe
37
+
38
+ labelframe $w.f -text "Value" -padx 2 -pady 2
39
+ grid $w.f -row 0 -column 0 -pady 2m -padx 2m
40
+
41
+ foreach value {1 2 3 4} {
42
+ radiobutton $w.f.b$value -text "This is value $value" \
43
+ -variable lfdummy -value $value
44
+ pack $w.f.b$value -side top -fill x -pady 2
45
+ }
46
+
47
+
48
+ # Using a label window to control a group of options.
49
+
50
+ proc lfEnableButtons {w} {
51
+ foreach child [winfo children $w] {
52
+ if {$child == "$w.cb"} continue
53
+ if {$::lfdummy2} {
54
+ $child configure -state normal
55
+ } else {
56
+ $child configure -state disabled
57
+ }
58
+ }
59
+ }
60
+
61
+ labelframe $w.f2 -pady 2 -padx 2
62
+ checkbutton $w.f2.cb -text "Use this option." -variable lfdummy2 \
63
+ -command "lfEnableButtons $w.f2" -padx 0
64
+ $w.f2 configure -labelwidget $w.f2.cb
65
+ grid $w.f2 -row 0 -column 1 -pady 2m -padx 2m
66
+
67
+ set t 0
68
+ foreach str {Option1 Option2 Option3} {
69
+ checkbutton $w.f2.b$t -text $str
70
+ pack $w.f2.b$t -side top -fill x -pady 2
71
+ incr t
72
+ }
73
+ lfEnableButtons $w.f2
74
+
75
+
76
+ grid columnconfigure $w {0 1} -weight 1
evalkit_llava/lib/tk8.6/demos/mclist.tcl ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # mclist.tcl --
2
+ #
3
+ # This demonstration script creates a toplevel window containing a Ttk
4
+ # tree widget configured as a multi-column listbox.
5
+
6
+ if {![info exists widgetDemo]} {
7
+ error "This script should be run from the \"widget\" demo."
8
+ }
9
+
10
+ package require Tk
11
+
12
+ set w .mclist
13
+ catch {destroy $w}
14
+ toplevel $w
15
+ wm title $w "Multi-Column List"
16
+ wm iconname $w "mclist"
17
+ positionWindow $w
18
+
19
+ ## Explanatory text
20
+ ttk::label $w.msg -font $font -wraplength 4i -justify left -anchor n -padding {10 2 10 6} -text "Ttk is the new Tk themed widget set. One of the widgets it includes is a tree widget, which can be configured to display multiple columns of informational data without displaying the tree itself. This is a simple way to build a listbox that has multiple columns. Clicking on the heading for a column will sort the data by that column. You can also change the width of the columns by dragging the boundary between them."
21
+ pack $w.msg -fill x
22
+
23
+ ## See Code / Dismiss
24
+ pack [addSeeDismiss $w.seeDismiss $w] -side bottom -fill x
25
+
26
+ ttk::frame $w.container
27
+ ttk::treeview $w.tree -columns {country capital currency} -show headings \
28
+ -yscroll "$w.vsb set" -xscroll "$w.hsb set"
29
+ ttk::scrollbar $w.vsb -orient vertical -command "$w.tree yview"
30
+ ttk::scrollbar $w.hsb -orient horizontal -command "$w.tree xview"
31
+ pack $w.container -fill both -expand 1
32
+ grid $w.tree $w.vsb -in $w.container -sticky nsew
33
+ grid $w.hsb -in $w.container -sticky nsew
34
+ grid column $w.container 0 -weight 1
35
+ grid row $w.container 0 -weight 1
36
+
37
+ image create photo upArrow -data {
38
+ R0lGODlhDgAOAJEAANnZ2YCAgPz8/P///yH5BAEAAAAALAAAAAAOAA4AAAImhI+
39
+ py+1LIsJHiBAh+BgmiEAJQITgW6DgUQIAECH4JN8IPqYuNxUAOw==}
40
+ image create photo downArrow -data {
41
+ R0lGODlhDgAOAJEAANnZ2YCAgPz8/P///yH5BAEAAAAALAAAAAAOAA4AAAInhI+
42
+ py+1I4ocQ/IgDEYIPgYJICUCE4F+YIBolEoKPEJKZmVJK6ZACADs=}
43
+ image create photo noArrow -height 14 -width 14
44
+
45
+ ## The data we're going to insert
46
+ set data {
47
+ Argentina {Buenos Aires} ARS
48
+ Australia Canberra AUD
49
+ Brazil Brazilia BRL
50
+ Canada Ottawa CAD
51
+ China Beijing CNY
52
+ France Paris EUR
53
+ Germany Berlin EUR
54
+ India {New Delhi} INR
55
+ Italy Rome EUR
56
+ Japan Tokyo JPY
57
+ Mexico {Mexico City} MXN
58
+ Russia Moscow RUB
59
+ {South Africa} Pretoria ZAR
60
+ {United Kingdom} London GBP
61
+ {United States} {Washington, D.C.} USD
62
+ }
63
+
64
+ ## Code to insert the data nicely
65
+ set font [ttk::style lookup Heading -font]
66
+ foreach col {country capital currency} name {Country Capital Currency} {
67
+ $w.tree heading $col -text $name -image noArrow -anchor w \
68
+ -command [list SortBy $w.tree $col 0]
69
+ $w.tree column $col -width [expr {
70
+ [font measure $font $name] + [image width noArrow] + 5
71
+ }]
72
+ }
73
+ set font [ttk::style lookup Treeview -font]
74
+ foreach {country capital currency} $data {
75
+ $w.tree insert {} end -values [list $country $capital $currency]
76
+ foreach col {country capital currency} {
77
+ set len [font measure $font "[set $col] "]
78
+ if {[$w.tree column $col -width] < $len} {
79
+ $w.tree column $col -width $len
80
+ }
81
+ }
82
+ }
83
+
84
+ ## Code to do the sorting of the tree contents when clicked on
85
+ proc SortBy {tree col direction} {
86
+ # Determine currently sorted column and its sort direction
87
+ foreach c {country capital currency} {
88
+ set s [$tree heading $c state]
89
+ if {("selected" in $s || "alternate" in $s) && $col ne $c} {
90
+ # Sorted column has changed
91
+ $tree heading $c -image noArrow state {!selected !alternate !user1}
92
+ set direction [expr {"alternate" in $s}]
93
+ }
94
+ }
95
+
96
+ # Build something we can sort
97
+ set data {}
98
+ foreach row [$tree children {}] {
99
+ lappend data [list [$tree set $row $col] $row]
100
+ }
101
+
102
+ set dir [expr {$direction ? "-decreasing" : "-increasing"}]
103
+ set r -1
104
+
105
+ # Now reshuffle the rows into the sorted order
106
+ foreach info [lsort -dictionary -index 0 $dir $data] {
107
+ $tree move [lindex $info 1] {} [incr r]
108
+ }
109
+
110
+ # Switch the heading so that it will sort in the opposite direction
111
+ $tree heading $col -command [list SortBy $tree $col [expr {!$direction}]] \
112
+ state [expr {$direction?"!selected alternate":"selected !alternate"}]
113
+ if {[ttk::style theme use] eq "aqua"} {
114
+ # Aqua theme displays native sort arrows when user1 state is set
115
+ $tree heading $col state "user1"
116
+ } else {
117
+ $tree heading $col -image [expr {$direction?"upArrow":"downArrow"}]
118
+ }
119
+ }
evalkit_llava/lib/tk8.6/demos/msgbox.tcl ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # msgbox.tcl --
2
+ #
3
+ # This demonstration script creates message boxes of various type
4
+
5
+ if {![info exists widgetDemo]} {
6
+ error "This script should be run from the \"widget\" demo."
7
+ }
8
+
9
+ package require Tk
10
+
11
+ set w .msgbox
12
+ catch {destroy $w}
13
+ toplevel $w
14
+ wm title $w "Message Box Demonstration"
15
+ wm iconname $w "messagebox"
16
+ positionWindow $w
17
+
18
+ label $w.msg -font $font -wraplength 4i -justify left -text "Choose the icon and type option of the message box. Then press the \"Message Box\" button to see the message box."
19
+ pack $w.msg -side top
20
+
21
+ pack [addSeeDismiss $w.buttons $w {} {
22
+ ttk::button $w.buttons.vars -text "Message Box" -command "showMessageBox $w"
23
+ }] -side bottom -fill x
24
+ #pack $w.buttons.dismiss $w.buttons.code $w.buttons.vars -side left -expand 1
25
+
26
+ frame $w.left
27
+ frame $w.right
28
+ pack $w.left $w.right -side left -expand yes -fill y -pady .5c -padx .5c
29
+
30
+ label $w.left.label -text "Icon"
31
+ frame $w.left.sep -relief ridge -bd 1 -height 2
32
+ pack $w.left.label -side top
33
+ pack $w.left.sep -side top -fill x -expand no
34
+
35
+ set msgboxIcon info
36
+ foreach i {error info question warning} {
37
+ radiobutton $w.left.b$i -text $i -variable msgboxIcon \
38
+ -relief flat -value $i -width 16 -anchor w
39
+ pack $w.left.b$i -side top -pady 2 -anchor w -fill x
40
+ }
41
+
42
+ label $w.right.label -text "Type"
43
+ frame $w.right.sep -relief ridge -bd 1 -height 2
44
+ pack $w.right.label -side top
45
+ pack $w.right.sep -side top -fill x -expand no
46
+
47
+ set msgboxType ok
48
+ foreach t {abortretryignore ok okcancel retrycancel yesno yesnocancel} {
49
+ radiobutton $w.right.$t -text $t -variable msgboxType \
50
+ -relief flat -value $t -width 16 -anchor w
51
+ pack $w.right.$t -side top -pady 2 -anchor w -fill x
52
+ }
53
+
54
+ proc showMessageBox {w} {
55
+ global msgboxIcon msgboxType
56
+ set button [tk_messageBox -icon $msgboxIcon -type $msgboxType \
57
+ -title Message -parent $w\
58
+ -message "This is a \"$msgboxType\" type messagebox with the \"$msgboxIcon\" icon"]
59
+
60
+ tk_messageBox -icon info -message "You have selected \"$button\"" -type ok\
61
+ -parent $w
62
+ }
evalkit_llava/lib/tk8.6/demos/nl.msg ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ::msgcat::mcset nl "Widget Demonstration" "Demonstratie van widgets"
2
+ ::msgcat::mcset nl "tkWidgetDemo" "tkWidgetDemo"
3
+ ::msgcat::mcset nl "&File" "&Bestand"
4
+ ::msgcat::mcset nl "About..." "Info..."
5
+ ::msgcat::mcset nl "&About..." "&Info..."
6
+ ::msgcat::mcset nl "<F1>" "<F1>"
7
+ ::msgcat::mcset nl "&Quit" "&Einde"
8
+ ::msgcat::mcset nl "Meta+Q" "Meta+E" ;# Displayed hotkey
9
+ ::msgcat::mcset nl "Meta-q" "Meta-e" ;# Actual binding sequence
10
+ ::msgcat::mcset nl "Ctrl+Q" "Ctrl+E" ;# Displayed hotkey
11
+ ::msgcat::mcset nl "Control-q" "Control-e" ;# Actual binding sequence
12
+ ::msgcat::mcset nl "Dismiss" "Sluiten"
13
+ ::msgcat::mcset nl "See Variables" "Bekijk Variabelen"
14
+ ::msgcat::mcset nl "Variable Values" "Waarden Variabelen"
15
+ ::msgcat::mcset nl "OK" "OK"
16
+ ::msgcat::mcset nl "Run the \"%s\" sample program" "Start voorbeeld \"%s\""
17
+ ::msgcat::mcset nl "Print Code" "Code Afdrukken"
18
+ ::msgcat::mcset nl "Demo code: %s" "Code van Demo %s"
19
+ ::msgcat::mcset nl "About Widget Demo" "Over deze demonstratie"
20
+ ::msgcat::mcset nl "Tk widget demonstration" "Demonstratie van Tk widgets"
21
+ ::msgcat::mcset nl "Copyright © %s"
22
+
23
+ ::msgcat::mcset nl "Tk Widget Demonstrations" "Demonstratie van Tk widgets"
24
+ ::msgcat::mcset nl "This application provides a front end for several short scripts" \
25
+ "Dit programma is een schil rond enkele korte scripts waarmee"
26
+ ::msgcat::mcset nl "that demonstrate what you can do with Tk widgets. Each of the" \
27
+ "gedemonstreerd wordt wat je kunt doen met Tk widgets. Elk van de"
28
+ ::msgcat::mcset nl "numbered lines below describes a demonstration; you can click on" \
29
+ "genummerde regels hieronder omschrijft een demonstratie; je kunt de"
30
+ ::msgcat::mcset nl "it to invoke the demonstration. Once the demonstration window" \
31
+ "demonstratie starten door op de regel te klikken."
32
+ ::msgcat::mcset nl "appears, you can click the" \
33
+ "Zodra het nieuwe venster verschijnt, kun je op de knop"
34
+ ::msgcat::mcset nl "See Code" "Bekijk Code" ;# This is also button text!
35
+ ::msgcat::mcset nl "button to see the Tcl/Tk code that created the demonstration. If" \
36
+ "drukken om de achterliggende Tcl/Tk code te zien. Als je dat wilt,"
37
+ ::msgcat::mcset nl "you wish, you can edit the code and click the" \
38
+ "kun je de code wijzigen en op de knop"
39
+ ::msgcat::mcset nl "Rerun Demo" "Herstart Demo" ;# This is also button text!
40
+ ::msgcat::mcset nl "button in the code window to reinvoke the demonstration with the" \
41
+ "drukken in het codevenster om de demonstratie uit te voeren met de"
42
+ ::msgcat::mcset nl "modified code." \
43
+ "nieuwe code."
44
+
45
+ ::msgcat::mcset nl "Labels, buttons, checkbuttons, and radiobuttons" \
46
+ "Labels, knoppen, vinkjes/aankruishokjes en radioknoppen"
47
+
48
+ ::msgcat::mcset nl "Labels (text and bitmaps)" "Labels (tekst en plaatjes)"
49
+ ::msgcat::mcset nl "Labels and UNICODE text" "Labels en tekst in UNICODE"
50
+ ::msgcat::mcset nl "Buttons" "Buttons (drukknoppen)"
51
+ ::msgcat::mcset nl "Check-buttons (select any of a group)" \
52
+ "Check-buttons (een of meer uit een groep)"
53
+ ::msgcat::mcset nl "Radio-buttons (select one of a group)" \
54
+ "Radio-buttons (een van een groep)"
55
+ ::msgcat::mcset nl "A 15-puzzle game made out of buttons" \
56
+ "Een schuifpuzzel van buttons"
57
+ ::msgcat::mcset nl "Iconic buttons that use bitmaps" \
58
+ "Buttons met pictogrammen"
59
+ ::msgcat::mcset nl "Two labels displaying images" \
60
+ "Twee labels met plaatjes in plaats van tekst"
61
+ ::msgcat::mcset nl "A simple user interface for viewing images" \
62
+ "Een eenvoudige user-interface voor het bekijken van plaatjes"
63
+ ::msgcat::mcset nl "Labelled frames" \
64
+ "Kaders met bijschrift"
65
+
66
+ ::msgcat::mcset nl "Listboxes" "Keuzelijsten"
67
+ ::msgcat::mcset nl "The 50 states" "De 50 staten van de VS"
68
+ ::msgcat::mcset nl "Colors: change the color scheme for the application" \
69
+ "Kleuren: verander het kleurenschema voor het programma"
70
+ ::msgcat::mcset nl "A collection of famous and infamous sayings" \
71
+ "Beroemde en beruchte citaten en gezegden"
72
+
73
+ ::msgcat::mcset nl "Entries and Spin-boxes" "Invulvelden en Spinboxen"
74
+ ::msgcat::mcset nl "Entries without scrollbars" "Invulvelden zonder schuifbalk"
75
+ ::msgcat::mcset nl "Entries with scrollbars" "Invulvelden met schuifbalk"
76
+ ::msgcat::mcset nl "Validated entries and password fields" \
77
+ "Invulvelden met controle of wachtwoorden"
78
+ ::msgcat::mcset nl "Spin-boxes" "Spinboxen"
79
+ ::msgcat::mcset nl "Simple Rolodex-like form" "Simpel kaartsysteem"
80
+
81
+ ::msgcat::mcset nl "Text" "Tekst"
82
+ ::msgcat::mcset nl "Basic editable text" "Voorbeeld met te wijzigen tekst"
83
+ ::msgcat::mcset nl "Text display styles" "Tekst met verschillende stijlen"
84
+ ::msgcat::mcset nl "Hypertext (tag bindings)" \
85
+ "Hypertext (verwijzingen via \"tags\")"
86
+ ::msgcat::mcset nl "A text widget with embedded windows" \
87
+ "Tekstwidget met windows erin"
88
+ ::msgcat::mcset nl "A search tool built with a text widget" \
89
+ "Zoeken in tekst met behulp van een tekstwidget"
90
+
91
+ ::msgcat::mcset nl "Canvases" "Canvaswidgets"
92
+ ::msgcat::mcset nl "The canvas item types" "Objecten in een canvas"
93
+ ::msgcat::mcset nl "A simple 2-D plot" "Eenvoudige 2D-grafiek"
94
+ ::msgcat::mcset nl "Text items in canvases" "Tekstobjecten in een canvas"
95
+ ::msgcat::mcset nl "An editor for arrowheads on canvas lines" \
96
+ "Editor voor de vorm van de pijl (begin/eind van een lijn)"
97
+ ::msgcat::mcset nl "A ruler with adjustable tab stops" \
98
+ "Een meetlat met aanpasbare ruiters"
99
+ ::msgcat::mcset nl "A building floor plan" "Plattegrond van een gebouw"
100
+ ::msgcat::mcset nl "A simple scrollable canvas" "Een schuifbaar canvas"
101
+
102
+ ::msgcat::mcset nl "Scales" "Schaalverdelingen"
103
+ ::msgcat::mcset nl "Horizontal scale" "Horizontale schaal"
104
+ ::msgcat::mcset nl "Vertical scale" "Verticale schaal"
105
+
106
+ ::msgcat::mcset nl "Paned Windows" "Vensters opgedeeld in stukken"
107
+ ::msgcat::mcset nl "Horizontal paned window" "Horizontaal gedeeld venster"
108
+ ::msgcat::mcset nl "Vertical paned window" "Verticaal gedeeld venster"
109
+
110
+ ::msgcat::mcset nl "Menus" "Menu's"
111
+ ::msgcat::mcset nl "Menus and cascades (sub-menus)" \
112
+ "Menu's en cascades (submenu's)"
113
+ ::msgcat::mcset nl "Menu-buttons" "Menu-buttons"
114
+
115
+ ::msgcat::mcset nl "Common Dialogs" "Veel voorkomende dialoogvensters"
116
+ ::msgcat::mcset nl "Message boxes" "Mededeling (message box)"
117
+ ::msgcat::mcset nl "File selection dialog" "Selectie van bestanden"
118
+ ::msgcat::mcset nl "Color picker" "Kleurenpalet"
119
+
120
+ ::msgcat::mcset nl "Miscellaneous" "Diversen"
121
+ ::msgcat::mcset nl "The built-in bitmaps" "Ingebouwde plaatjes"
122
+ ::msgcat::mcset nl "A dialog box with a local grab" \
123
+ "Een dialoogvenster met een locale \"grab\""
124
+ ::msgcat::mcset nl "A dialog box with a global grab" \
125
+ "Een dialoogvenster met een globale \"grab\""
evalkit_llava/lib/tk8.6/demos/pendulum.tcl ADDED
@@ -0,0 +1,197 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # pendulum.tcl --
2
+ #
3
+ # This demonstration illustrates how Tcl/Tk can be used to construct
4
+ # simulations of physical systems.
5
+
6
+ if {![info exists widgetDemo]} {
7
+ error "This script should be run from the \"widget\" demo."
8
+ }
9
+
10
+ package require Tk
11
+
12
+ set w .pendulum
13
+ catch {destroy $w}
14
+ toplevel $w
15
+ wm title $w "Pendulum Animation Demonstration"
16
+ wm iconname $w "pendulum"
17
+ positionWindow $w
18
+
19
+ label $w.msg -font $font -wraplength 4i -justify left -text "This demonstration shows how Tcl/Tk can be used to carry out animations that are linked to simulations of physical systems. In the left canvas is a graphical representation of the physical system itself, a simple pendulum, and in the right canvas is a graph of the phase space of the system, which is a plot of the angle (relative to the vertical) against the angular velocity. The pendulum bob may be repositioned by clicking and dragging anywhere on the left canvas."
20
+ pack $w.msg
21
+
22
+ ## See Code / Dismiss buttons
23
+ set btns [addSeeDismiss $w.buttons $w]
24
+ pack $btns -side bottom -fill x
25
+
26
+ # Create some structural widgets
27
+ pack [panedwindow $w.p] -fill both -expand 1
28
+ $w.p add [labelframe $w.p.l1 -text "Pendulum Simulation"]
29
+ $w.p add [labelframe $w.p.l2 -text "Phase Space"]
30
+
31
+ # Create the canvas containing the graphical representation of the
32
+ # simulated system.
33
+ canvas $w.c -width 320 -height 200 -background white -bd 2 -relief sunken
34
+ $w.c create text 5 5 -anchor nw -text "Click to Adjust Bob Start Position"
35
+ # Coordinates of these items don't matter; they will be set properly below
36
+ $w.c create line 0 25 320 25 -tags plate -fill grey50 -width 2
37
+ $w.c create oval 155 20 165 30 -tags pivot -fill grey50 -outline {}
38
+ $w.c create line 1 1 1 1 -tags rod -fill black -width 3
39
+ $w.c create oval 1 1 2 2 -tags bob -fill yellow -outline black
40
+ pack $w.c -in $w.p.l1 -fill both -expand true
41
+
42
+ # Create the canvas containing the phase space graph; this consists of
43
+ # a line that gets gradually paler as it ages, which is an extremely
44
+ # effective visual trick.
45
+ canvas $w.k -width 320 -height 200 -background white -bd 2 -relief sunken
46
+ $w.k create line 160 200 160 0 -fill grey75 -arrow last -tags y_axis
47
+ $w.k create line 0 100 320 100 -fill grey75 -arrow last -tags x_axis
48
+ for {set i 90} {$i>=0} {incr i -10} {
49
+ # Coordinates of these items don't matter; they will be set properly below
50
+ $w.k create line 0 0 1 1 -smooth true -tags graph$i -fill grey$i
51
+ }
52
+
53
+ $w.k create text 0 0 -anchor ne -text "\u03b8" -tags label_theta
54
+ $w.k create text 0 0 -anchor ne -text "\u03b4\u03b8" -tags label_dtheta
55
+ pack $w.k -in $w.p.l2 -fill both -expand true
56
+
57
+ # Initialize some variables
58
+ set points {}
59
+ set Theta 45.0
60
+ set dTheta 0.0
61
+ set pi 3.1415926535897933
62
+ set length 150
63
+ set home 160
64
+
65
+ # This procedure makes the pendulum appear at the correct place on the
66
+ # canvas. If the additional arguments "at $x $y" are passed (the 'at'
67
+ # is really just syntactic sugar) instead of computing the position of
68
+ # the pendulum from the length of the pendulum rod and its angle, the
69
+ # length and angle are computed in reverse from the given location
70
+ # (which is taken to be the centre of the pendulum bob.)
71
+ proc showPendulum {canvas {at {}} {x {}} {y {}}} {
72
+ global Theta dTheta pi length home
73
+ if {$at eq "at" && ($x!=$home || $y!=25)} {
74
+ set dTheta 0.0
75
+ set x2 [expr {$x - $home}]
76
+ set y2 [expr {$y - 25}]
77
+ set length [expr {hypot($x2, $y2)}]
78
+ set Theta [expr {atan2($x2, $y2) * 180/$pi}]
79
+ } else {
80
+ set angle [expr {$Theta * $pi/180}]
81
+ set x [expr {$home + $length*sin($angle)}]
82
+ set y [expr {25 + $length*cos($angle)}]
83
+ }
84
+ $canvas coords rod $home 25 $x $y
85
+ $canvas coords bob [expr {$x - 15}] [expr {$y - 15}] \
86
+ [expr {$x + 15}] [expr {$y + 15}]
87
+ }
88
+ showPendulum $w.c
89
+
90
+ # Update the phase-space graph according to the current angle and the
91
+ # rate at which the angle is changing (the first derivative with
92
+ # respect to time.)
93
+ proc showPhase {canvas} {
94
+ global Theta dTheta points psw psh
95
+ lappend points [expr {$Theta + $psw}] [expr {-20*$dTheta + $psh}]
96
+ if {[llength $points] > 100} {
97
+ set points [lrange $points end-99 end]
98
+ }
99
+ for {set i 0} {$i<100} {incr i 10} {
100
+ set list [lrange $points end-[expr {$i-1}] end-[expr {$i-12}]]
101
+ if {[llength $list] >= 4} {
102
+ $canvas coords graph$i $list
103
+ }
104
+ }
105
+ }
106
+
107
+ # Set up some bindings on the canvases. Note that when the user
108
+ # clicks we stop the animation until they release the mouse
109
+ # button. Also note that both canvases are sensitive to <Configure>
110
+ # events, which allows them to find out when they have been resized by
111
+ # the user.
112
+ bind $w.c <Destroy> {
113
+ after cancel $animationCallbacks(pendulum)
114
+ unset animationCallbacks(pendulum)
115
+ }
116
+ bind $w.c <Button-1> {
117
+ after cancel $animationCallbacks(pendulum)
118
+ showPendulum %W at %x %y
119
+ }
120
+ bind $w.c <B1-Motion> {
121
+ showPendulum %W at %x %y
122
+ }
123
+ bind $w.c <ButtonRelease-1> {
124
+ showPendulum %W at %x %y
125
+ set animationCallbacks(pendulum) [after 15 repeat [winfo toplevel %W]]
126
+ }
127
+ bind $w.c <Configure> {
128
+ %W coords plate 0 25 %w 25
129
+ set home [expr {%w/2}]
130
+ %W coords pivot [expr {$home - 5}] 20 [expr {$home + 5}] 30
131
+ }
132
+ bind $w.k <Configure> {
133
+ set psh [expr {%h/2}]
134
+ set psw [expr {%w/2}]
135
+ %W coords x_axis 2 $psh [expr {%w - 2}] $psh
136
+ %W coords y_axis $psw [expr {%h - 2}] $psw 2
137
+ %W coords label_dtheta [expr {$psw - 4}] 6
138
+ %W coords label_theta [expr {%w - 6}] [expr {$psh + 4}]
139
+ }
140
+
141
+ # This procedure is the "business" part of the simulation that does
142
+ # simple numerical integration of the formula for a simple rotational
143
+ # pendulum.
144
+ proc recomputeAngle {} {
145
+ global Theta dTheta pi length
146
+ set scaling [expr {3000.0/$length/$length}]
147
+
148
+ # To estimate the integration accurately, we really need to
149
+ # compute the end-point of our time-step. But to do *that*, we
150
+ # need to estimate the integration accurately! So we try this
151
+ # technique, which is inaccurate, but better than doing it in a
152
+ # single step. What we really want is bound up in the
153
+ # differential equation:
154
+ # .. - sin theta
155
+ # theta + theta = -----------
156
+ # length
157
+ # But my math skills are not good enough to solve this!
158
+
159
+ # first estimate
160
+ set firstDDTheta [expr {-sin($Theta * $pi/180)*$scaling}]
161
+ set midDTheta [expr {$dTheta + $firstDDTheta}]
162
+ set midTheta [expr {$Theta + ($dTheta + $midDTheta)/2}]
163
+ # second estimate
164
+ set midDDTheta [expr {-sin($midTheta * $pi/180)*$scaling}]
165
+ set midDTheta [expr {$dTheta + ($firstDDTheta + $midDDTheta)/2}]
166
+ set midTheta [expr {$Theta + ($dTheta + $midDTheta)/2}]
167
+ # Now we do a double-estimate approach for getting the final value
168
+ # first estimate
169
+ set midDDTheta [expr {-sin($midTheta * $pi/180)*$scaling}]
170
+ set lastDTheta [expr {$midDTheta + $midDDTheta}]
171
+ set lastTheta [expr {$midTheta + ($midDTheta + $lastDTheta)/2}]
172
+ # second estimate
173
+ set lastDDTheta [expr {-sin($lastTheta * $pi/180)*$scaling}]
174
+ set lastDTheta [expr {$midDTheta + ($midDDTheta + $lastDDTheta)/2}]
175
+ set lastTheta [expr {$midTheta + ($midDTheta + $lastDTheta)/2}]
176
+ # Now put the values back in our globals
177
+ set dTheta $lastDTheta
178
+ set Theta $lastTheta
179
+ }
180
+
181
+ # This method ties together the simulation engine and the graphical
182
+ # display code that visualizes it.
183
+ proc repeat w {
184
+ global animationCallbacks
185
+
186
+ # Simulate
187
+ recomputeAngle
188
+
189
+ # Update the display
190
+ showPendulum $w.c
191
+ showPhase $w.k
192
+
193
+ # Reschedule ourselves
194
+ set animationCallbacks(pendulum) [after 15 [list repeat $w]]
195
+ }
196
+ # Start the simulation after a short pause
197
+ set animationCallbacks(pendulum) [after 500 [list repeat $w]]
evalkit_llava/lib/tk8.6/demos/plot.tcl ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # plot.tcl --
2
+ #
3
+ # This demonstration script creates a canvas widget showing a 2-D
4
+ # plot with data points that can be dragged with the mouse.
5
+
6
+ if {![info exists widgetDemo]} {
7
+ error "This script should be run from the \"widget\" demo."
8
+ }
9
+
10
+ package require Tk
11
+
12
+ set w .plot
13
+ catch {destroy $w}
14
+ toplevel $w
15
+ wm title $w "Plot Demonstration"
16
+ wm iconname $w "Plot"
17
+ positionWindow $w
18
+ set c $w.c
19
+
20
+ label $w.msg -font $font -wraplength 4i -justify left -text "This window displays a canvas widget containing a simple 2-dimensional plot. You can doctor the data by dragging any of the points with mouse button 1."
21
+ pack $w.msg -side top
22
+
23
+ ## See Code / Dismiss buttons
24
+ set btns [addSeeDismiss $w.buttons $w]
25
+ pack $btns -side bottom -fill x
26
+
27
+ canvas $c -relief raised -width 450 -height 300
28
+ pack $w.c -side top -fill x
29
+
30
+ set plotFont {Helvetica 18}
31
+
32
+ $c create line 100 250 400 250 -width 2
33
+ $c create line 100 250 100 50 -width 2
34
+ $c create text 225 20 -text "A Simple Plot" -font $plotFont -fill brown
35
+
36
+ for {set i 0} {$i <= 10} {incr i} {
37
+ set x [expr {100 + ($i*30)}]
38
+ $c create line $x 250 $x 245 -width 2
39
+ $c create text $x 254 -text [expr {10*$i}] -anchor n -font $plotFont
40
+ }
41
+ for {set i 0} {$i <= 5} {incr i} {
42
+ set y [expr {250 - ($i*40)}]
43
+ $c create line 100 $y 105 $y -width 2
44
+ $c create text 96 $y -text [expr {$i*50}].0 -anchor e -font $plotFont
45
+ }
46
+
47
+ foreach point {
48
+ {12 56} {20 94} {33 98} {32 120} {61 180} {75 160} {98 223}
49
+ } {
50
+ set x [expr {100 + (3*[lindex $point 0])}]
51
+ set y [expr {250 - (4*[lindex $point 1])/5}]
52
+ set item [$c create oval [expr {$x-6}] [expr {$y-6}] \
53
+ [expr {$x+6}] [expr {$y+6}] -width 1 -outline black \
54
+ -fill SkyBlue2]
55
+ $c addtag point withtag $item
56
+ }
57
+
58
+ $c bind point <Enter> "$c itemconfig current -fill red"
59
+ $c bind point <Leave> "$c itemconfig current -fill SkyBlue2"
60
+ $c bind point <Button-1> "plotDown $c %x %y"
61
+ $c bind point <ButtonRelease-1> "$c dtag selected"
62
+ bind $c <B1-Motion> "plotMove $c %x %y"
63
+
64
+ set plot(lastX) 0
65
+ set plot(lastY) 0
66
+
67
+ # plotDown --
68
+ # This procedure is invoked when the mouse is pressed over one of the
69
+ # data points. It sets up state to allow the point to be dragged.
70
+ #
71
+ # Arguments:
72
+ # w - The canvas window.
73
+ # x, y - The coordinates of the mouse press.
74
+
75
+ proc plotDown {w x y} {
76
+ global plot
77
+ $w dtag selected
78
+ $w addtag selected withtag current
79
+ $w raise current
80
+ set plot(lastX) $x
81
+ set plot(lastY) $y
82
+ }
83
+
84
+ # plotMove --
85
+ # This procedure is invoked during mouse motion events. It drags the
86
+ # current item.
87
+ #
88
+ # Arguments:
89
+ # w - The canvas window.
90
+ # x, y - The coordinates of the mouse.
91
+
92
+ proc plotMove {w x y} {
93
+ global plot
94
+ $w move selected [expr {$x-$plot(lastX)}] [expr {$y-$plot(lastY)}]
95
+ set plot(lastX) $x
96
+ set plot(lastY) $y
97
+ }
evalkit_llava/lib/tk8.6/demos/puzzle.tcl ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # puzzle.tcl --
2
+ #
3
+ # This demonstration script creates a 15-puzzle game using a collection
4
+ # of buttons.
5
+
6
+ if {![info exists widgetDemo]} {
7
+ error "This script should be run from the \"widget\" demo."
8
+ }
9
+
10
+ package require Tk
11
+
12
+ # puzzleSwitch --
13
+ # This procedure is invoked when the user clicks on a particular button;
14
+ # if the button is next to the empty space, it moves the button into the
15
+ # empty space.
16
+
17
+ proc puzzleSwitch {w num} {
18
+ global xpos ypos
19
+ if {(($ypos($num) >= ($ypos(space) - .01))
20
+ && ($ypos($num) <= ($ypos(space) + .01))
21
+ && ($xpos($num) >= ($xpos(space) - .26))
22
+ && ($xpos($num) <= ($xpos(space) + .26)))
23
+ || (($xpos($num) >= ($xpos(space) - .01))
24
+ && ($xpos($num) <= ($xpos(space) + .01))
25
+ && ($ypos($num) >= ($ypos(space) - .26))
26
+ && ($ypos($num) <= ($ypos(space) + .26)))} {
27
+ set tmp $xpos(space)
28
+ set xpos(space) $xpos($num)
29
+ set xpos($num) $tmp
30
+ set tmp $ypos(space)
31
+ set ypos(space) $ypos($num)
32
+ set ypos($num) $tmp
33
+ place $w.frame.$num -relx $xpos($num) -rely $ypos($num)
34
+ }
35
+ }
36
+
37
+ set w .puzzle
38
+ catch {destroy $w}
39
+ toplevel $w
40
+ wm title $w "15-Puzzle Demonstration"
41
+ wm iconname $w "15-Puzzle"
42
+ positionWindow $w
43
+
44
+ label $w.msg -font $font -wraplength 4i -justify left -text "A 15-puzzle appears below as a collection of buttons. Click on any of the pieces next to the space, and that piece will slide over the space. Continue this until the pieces are arranged in numerical order from upper-left to lower-right."
45
+ pack $w.msg -side top
46
+
47
+ ## See Code / Dismiss buttons
48
+ set btns [addSeeDismiss $w.buttons $w]
49
+ pack $btns -side bottom -fill x
50
+
51
+ # Special trick: select a darker color for the space by creating a
52
+ # scrollbar widget and using its trough color.
53
+
54
+ scrollbar $w.s
55
+
56
+ # The button metrics are a bit bigger in Aqua, and since we are
57
+ # using place which doesn't autosize, then we need to have a
58
+ # slightly larger frame here...
59
+
60
+ if {[tk windowingsystem] eq "aqua"} {
61
+ set frameSize 168
62
+ } else {
63
+ set frameSize 120
64
+ }
65
+
66
+ frame $w.frame -width $frameSize -height $frameSize -borderwidth 2\
67
+ -relief sunken -bg [$w.s cget -troughcolor]
68
+ pack $w.frame -side top -pady 1c -padx 1c
69
+ destroy $w.s
70
+
71
+ set order {3 1 6 2 5 7 15 13 4 11 8 9 14 10 12}
72
+ for {set i 0} {$i < 15} {set i [expr {$i+1}]} {
73
+ set num [lindex $order $i]
74
+ set xpos($num) [expr {($i%4)*.25}]
75
+ set ypos($num) [expr {($i/4)*.25}]
76
+ button $w.frame.$num -relief raised -text $num -bd 0 -highlightthickness 0 \
77
+ -command "puzzleSwitch $w $num"
78
+ place $w.frame.$num -relx $xpos($num) -rely $ypos($num) \
79
+ -relwidth .25 -relheight .25
80
+ }
81
+ set xpos(space) .75
82
+ set ypos(space) .75
evalkit_llava/lib/tk8.6/demos/rmt ADDED
@@ -0,0 +1,210 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/sh
2
+ # the next line restarts using wish \
3
+ exec wish8.6 "$0" ${1+"$@"}
4
+
5
+ # rmt --
6
+ # This script implements a simple remote-control mechanism for
7
+ # Tk applications. It allows you to select an application and
8
+ # then type commands to that application.
9
+
10
+ package require Tk
11
+
12
+ wm title . "Tk Remote Controller"
13
+ wm iconname . "Tk Remote"
14
+ wm minsize . 1 1
15
+
16
+ # The global variable below keeps track of the remote application
17
+ # that we're sending to. If it's an empty string then we execute
18
+ # the commands locally.
19
+
20
+ set app "local"
21
+
22
+ # The global variable below keeps track of whether we're in the
23
+ # middle of executing a command entered via the text.
24
+
25
+ set executing 0
26
+
27
+ # The global variable below keeps track of the last command executed,
28
+ # so it can be re-executed in response to !! commands.
29
+
30
+ set lastCommand ""
31
+
32
+ # Create menu bar. Arrange to recreate all the information in the
33
+ # applications sub-menu whenever it is cascaded to.
34
+
35
+ . configure -menu [menu .menu]
36
+ menu .menu.file
37
+ menu .menu.file.apps -postcommand fillAppsMenu
38
+ .menu add cascade -label "File" -underline 0 -menu .menu.file
39
+ .menu.file add cascade -label "Select Application" -underline 0 \
40
+ -menu .menu.file.apps
41
+ .menu.file add command -label "Quit" -command "destroy ." -underline 0
42
+
43
+ # Create text window and scrollbar.
44
+
45
+ text .t -yscrollcommand ".s set" -setgrid true
46
+ scrollbar .s -command ".t yview"
47
+ grid .t .s -sticky nsew
48
+ grid rowconfigure . 0 -weight 1
49
+ grid columnconfigure . 0 -weight 1
50
+
51
+ # Create a binding to forward commands to the target application,
52
+ # plus modify many of the built-in bindings so that only information
53
+ # in the current command can be deleted (can still set the cursor
54
+ # earlier in the text and select and insert; just can't delete).
55
+
56
+ bindtags .t {.t Text . all}
57
+ bind .t <Return> {
58
+ .t mark set insert {end - 1c}
59
+ .t insert insert \n
60
+ invoke
61
+ break
62
+ }
63
+ bind .t <Delete> {
64
+ catch {.t tag remove sel sel.first promptEnd}
65
+ if {[.t tag nextrange sel 1.0 end] eq ""} {
66
+ if {[.t compare insert < promptEnd]} {
67
+ break
68
+ }
69
+ }
70
+ }
71
+ bind .t <BackSpace> {
72
+ catch {.t tag remove sel sel.first promptEnd}
73
+ if {[.t tag nextrange sel 1.0 end] eq ""} {
74
+ if {[.t compare insert <= promptEnd]} {
75
+ break
76
+ }
77
+ }
78
+ }
79
+ bind .t <Control-d> {
80
+ if {[.t compare insert < promptEnd]} {
81
+ break
82
+ }
83
+ }
84
+ bind .t <Control-k> {
85
+ if {[.t compare insert < promptEnd]} {
86
+ .t mark set insert promptEnd
87
+ }
88
+ }
89
+ bind .t <Control-t> {
90
+ if {[.t compare insert < promptEnd]} {
91
+ break
92
+ }
93
+ }
94
+ bind .t <Meta-d> {
95
+ if {[.t compare insert < promptEnd]} {
96
+ break
97
+ }
98
+ }
99
+ bind .t <Meta-BackSpace> {
100
+ if {[.t compare insert <= promptEnd]} {
101
+ break
102
+ }
103
+ }
104
+ bind .t <Control-h> {
105
+ if {[.t compare insert <= promptEnd]} {
106
+ break
107
+ }
108
+ }
109
+ ### This next bit *isn't* nice - DKF ###
110
+ auto_load tk::TextInsert
111
+ proc tk::TextInsert {w s} {
112
+ if {$s eq ""} {
113
+ return
114
+ }
115
+ catch {
116
+ if {
117
+ [$w compare sel.first <= insert] && [$w compare sel.last >= insert]
118
+ } then {
119
+ $w tag remove sel sel.first promptEnd
120
+ $w delete sel.first sel.last
121
+ }
122
+ }
123
+ $w insert insert $s
124
+ $w see insert
125
+ }
126
+
127
+ .t configure -font {Courier 12}
128
+ .t tag configure bold -font {Courier 12 bold}
129
+
130
+ # The procedure below is used to print out a prompt at the
131
+ # insertion point (which should be at the beginning of a line
132
+ # right now).
133
+
134
+ proc prompt {} {
135
+ global app
136
+ .t insert insert "$app: "
137
+ .t mark set promptEnd {insert}
138
+ .t mark gravity promptEnd left
139
+ .t tag add bold {promptEnd linestart} promptEnd
140
+ }
141
+
142
+ # The procedure below executes a command (it takes everything on the
143
+ # current line after the prompt and either sends it to the remote
144
+ # application or executes it locally, depending on "app".
145
+
146
+ proc invoke {} {
147
+ global app executing lastCommand
148
+ set cmd [.t get promptEnd insert]
149
+ incr executing 1
150
+ if {[info complete $cmd]} {
151
+ if {$cmd eq "!!\n"} {
152
+ set cmd $lastCommand
153
+ } else {
154
+ set lastCommand $cmd
155
+ }
156
+ if {$app eq "local"} {
157
+ set result [catch [list uplevel #0 $cmd] msg]
158
+ } else {
159
+ set result [catch [list send $app $cmd] msg]
160
+ }
161
+ if {$result != 0} {
162
+ .t insert insert "Error: $msg\n"
163
+ } elseif {$msg ne ""} {
164
+ .t insert insert $msg\n
165
+ }
166
+ prompt
167
+ .t mark set promptEnd insert
168
+ }
169
+ incr executing -1
170
+ .t yview -pickplace insert
171
+ }
172
+
173
+ # The following procedure is invoked to change the application that
174
+ # we're talking to. It also updates the prompt for the current
175
+ # command, unless we're in the middle of executing a command from
176
+ # the text item (in which case a new prompt is about to be output
177
+ # so there's no need to change the old one).
178
+
179
+ proc newApp appName {
180
+ global app executing
181
+ set app $appName
182
+ if {!$executing} {
183
+ .t mark gravity promptEnd right
184
+ .t delete "promptEnd linestart" promptEnd
185
+ .t insert promptEnd "$appName: "
186
+ .t tag add bold "promptEnd linestart" promptEnd
187
+ .t mark gravity promptEnd left
188
+ }
189
+ return
190
+ }
191
+
192
+ # The procedure below will fill in the applications sub-menu with a list
193
+ # of all the applications that currently exist.
194
+
195
+ proc fillAppsMenu {} {
196
+ set m .menu.file.apps
197
+ catch {$m delete 0 last}
198
+ foreach i [lsort [winfo interps]] {
199
+ $m add command -label $i -command [list newApp $i]
200
+ }
201
+ $m add command -label local -command {newApp local}
202
+ }
203
+
204
+ set app [winfo name .]
205
+ prompt
206
+ focus .t
207
+
208
+ # Local Variables:
209
+ # mode: tcl
210
+ # End:
evalkit_llava/lib/tk8.6/demos/rolodex ADDED
@@ -0,0 +1,204 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/sh
2
+ # the next line restarts using wish \
3
+ exec wish8.6 "$0" ${1+"$@"}
4
+
5
+ # rolodex --
6
+ # This script was written as an entry in Tom LaStrange's rolodex
7
+ # benchmark. It creates something that has some of the look and
8
+ # feel of a rolodex program, although it's lifeless and doesn't
9
+ # actually do the rolodex application.
10
+
11
+ package require Tk
12
+
13
+ foreach i [winfo children .] {
14
+ catch {destroy $i}
15
+ }
16
+
17
+ set version 1.2
18
+
19
+ #------------------------------------------
20
+ # Phase 0: create the front end.
21
+ #------------------------------------------
22
+
23
+ frame .frame -relief flat
24
+ pack .frame -side top -fill y -anchor center
25
+
26
+ set names {{} Name: Address: {} {} {Home Phone:} {Work Phone:} Fax:}
27
+ foreach i {1 2 3 4 5 6 7} {
28
+ label .frame.label$i -text [lindex $names $i] -anchor e
29
+ entry .frame.entry$i -width 35
30
+ grid .frame.label$i .frame.entry$i -sticky ew -pady 2 -padx 1
31
+ }
32
+
33
+ frame .buttons
34
+ pack .buttons -side bottom -pady 2 -anchor center
35
+ button .buttons.clear -text Clear
36
+ button .buttons.add -text Add
37
+ button .buttons.search -text Search
38
+ button .buttons.delete -text "Delete ..."
39
+ pack .buttons.clear .buttons.add .buttons.search .buttons.delete \
40
+ -side left -padx 2
41
+
42
+ #------------------------------------------
43
+ # Phase 1: Add menus, dialog boxes
44
+ #------------------------------------------
45
+
46
+ # DKF - note that this is an old-style menu bar; I just have not yet
47
+ # got around to converting the context help code to work with the new
48
+ # menu system and its <<MenuSelect>> virtual event.
49
+
50
+ frame .menu -relief raised -borderwidth 1
51
+ pack .menu -before .frame -side top -fill x
52
+
53
+ menubutton .menu.file -text "File" -menu .menu.file.m -underline 0
54
+ menu .menu.file.m
55
+ .menu.file.m add command -label "Load ..." -command fileAction -underline 0
56
+ .menu.file.m add command -label "Exit" -command {destroy .} -underline 0
57
+ pack .menu.file -side left
58
+
59
+ menubutton .menu.help -text "Help" -menu .menu.help.m -underline 0
60
+ menu .menu.help.m
61
+ pack .menu.help -side right
62
+
63
+ proc deleteAction {} {
64
+ if {[tk_dialog .delete {Confirm Action} {Are you sure?} {} 0 Cancel]
65
+ == 0} {
66
+ clearAction
67
+ }
68
+ }
69
+ .buttons.delete config -command deleteAction
70
+
71
+ proc fileAction {} {
72
+ tk_dialog .fileSelection {File Selection} {This is a dummy file selection dialog box, which is used because there isn't a good file selection dialog built into Tk yet.} {} 0 OK
73
+ puts stderr {dummy file name}
74
+ }
75
+
76
+ #------------------------------------------
77
+ # Phase 3: Print contents of card
78
+ #------------------------------------------
79
+
80
+ proc addAction {} {
81
+ global names
82
+ foreach i {1 2 3 4 5 6 7} {
83
+ puts stderr [format "%-12s %s" [lindex $names $i] [.frame.entry$i get]]
84
+ }
85
+ }
86
+ .buttons.add config -command addAction
87
+
88
+ #------------------------------------------
89
+ # Phase 4: Miscellaneous other actions
90
+ #------------------------------------------
91
+
92
+ proc clearAction {} {
93
+ foreach i {1 2 3 4 5 6 7} {
94
+ .frame.entry$i delete 0 end
95
+ }
96
+ }
97
+ .buttons.clear config -command clearAction
98
+
99
+ proc fillCard {} {
100
+ clearAction
101
+ .frame.entry1 insert 0 "John Ousterhout"
102
+ .frame.entry2 insert 0 "CS Division, Department of EECS"
103
+ .frame.entry3 insert 0 "University of California"
104
+ .frame.entry4 insert 0 "Berkeley, CA 94720"
105
+ .frame.entry5 insert 0 "private"
106
+ .frame.entry6 insert 0 "510-642-0865"
107
+ .frame.entry7 insert 0 "510-642-5775"
108
+ }
109
+ .buttons.search config -command "addAction; fillCard"
110
+
111
+ #----------------------------------------------------
112
+ # Phase 5: Accelerators, mnemonics, command-line info
113
+ #----------------------------------------------------
114
+
115
+ .buttons.clear config -text "Clear Ctrl+C"
116
+ bind . <Control-c> clearAction
117
+ .buttons.add config -text "Add Ctrl+A"
118
+ bind . <Control-a> addAction
119
+ .buttons.search config -text "Search Ctrl+S"
120
+ bind . <Control-s> "addAction; fillCard"
121
+ .buttons.delete config -text "Delete... Ctrl+D"
122
+ bind . <Control-d> deleteAction
123
+
124
+ .menu.file.m entryconfig 1 -accel Ctrl+F
125
+ bind . <Control-f> fileAction
126
+ .menu.file.m entryconfig 2 -accel Ctrl+Q
127
+ bind . <Control-q> {destroy .}
128
+
129
+ focus .frame.entry1
130
+
131
+ #----------------------------------------------------
132
+ # Phase 6: help
133
+ #----------------------------------------------------
134
+
135
+ proc Help {topic {x 0} {y 0}} {
136
+ global helpTopics helpCmds
137
+ if {$topic == ""} return
138
+ while {[info exists helpCmds($topic)]} {
139
+ set topic [eval $helpCmds($topic)]
140
+ }
141
+ if [info exists helpTopics($topic)] {
142
+ set msg $helpTopics($topic)
143
+ } else {
144
+ set msg "Sorry, but no help is available for this topic"
145
+ }
146
+ tk_dialog .help {Rolodex Help} "Information on $topic:\n\n$msg" \
147
+ {} 0 OK
148
+ }
149
+
150
+ proc getMenuTopic {w x y} {
151
+ return $w.[$w index @[expr {$y-[winfo rooty $w]}]]
152
+ }
153
+
154
+ event add <<Help>> <F1> <Help>
155
+ bind . <<Help>> {Help [winfo containing %X %Y] %X %Y}
156
+ bind Menu <<Help>> {Help [winfo containing %X %Y] %X %Y}
157
+
158
+ # Help text and commands follow:
159
+
160
+ set helpTopics(.menu.file) {This is the "file" menu. It can be used to invoke some overall operations on the rolodex applications, such as loading a file or exiting.}
161
+
162
+ set helpCmds(.menu.file.m) {getMenuTopic $topic $x $y}
163
+ set helpTopics(.menu.file.m.1) {The "Load" entry in the "File" menu posts a dialog box that you can use to select a rolodex file}
164
+ set helpTopics(.menu.file.m.2) {The "Exit" entry in the "File" menu causes the rolodex application to terminate}
165
+ set helpCmds(.menu.file.m.none) {set topic ".menu.file"}
166
+
167
+ set helpTopics(.frame.entry1) {In this field of the rolodex entry you should type the person's name}
168
+ set helpTopics(.frame.entry2) {In this field of the rolodex entry you should type the first line of the person's address}
169
+ set helpTopics(.frame.entry3) {In this field of the rolodex entry you should type the second line of the person's address}
170
+ set helpTopics(.frame.entry4) {In this field of the rolodex entry you should type the third line of the person's address}
171
+ set helpTopics(.frame.entry5) {In this field of the rolodex entry you should type the person's home phone number, or "private" if the person doesn't want his or her number publicized}
172
+ set helpTopics(.frame.entry6) {In this field of the rolodex entry you should type the person's work phone number}
173
+ set helpTopics(.frame.entry7) {In this field of the rolodex entry you should type the phone number for the person's FAX machine}
174
+
175
+ set helpCmds(.frame.label1) {set topic .frame.entry1}
176
+ set helpCmds(.frame.label2) {set topic .frame.entry2}
177
+ set helpCmds(.frame.label3) {set topic .frame.entry3}
178
+ set helpCmds(.frame.label4) {set topic .frame.entry4}
179
+ set helpCmds(.frame.label5) {set topic .frame.entry5}
180
+ set helpCmds(.frame.label6) {set topic .frame.entry6}
181
+ set helpCmds(.frame.label7) {set topic .frame.entry7}
182
+
183
+ set helpTopics(context) {Unfortunately, this application doesn't support context-sensitive help in the usual way, because when this demo was written Tk didn't have a grab mechanism and this is needed for context-sensitive help. Instead, you can achieve much the same effect by simply moving the mouse over the window you're curious about and pressing the Help or F1 keys. You can do this anytime.}
184
+ set helpTopics(help) {This application provides only very crude help. Besides the entries in this menu, you can get help on individual windows by moving the mouse cursor over the window and pressing the Help or F1 keys.}
185
+ set helpTopics(window) {This window is a dummy rolodex application created as part of Tom LaStrange's toolkit benchmark. It doesn't really do anything useful except to demonstrate a few features of the Tk toolkit.}
186
+ set helpTopics(keys) "The following accelerator keys are defined for this application (in addition to those already available for the entry windows):\n\nCtrl+A:\t\tAdd\nCtrl+C:\t\tClear\nCtrl+D:\t\tDelete\nCtrl+F:\t\tEnter file name\nCtrl+Q:\t\tExit application (quit)\nCtrl+S:\t\tSearch (dummy operation)"
187
+ set helpTopics(version) "This is version $version."
188
+
189
+ # Entries in "Help" menu
190
+
191
+ .menu.help.m add command -label "On Context..." -command {Help context} \
192
+ -underline 3
193
+ .menu.help.m add command -label "On Help..." -command {Help help} \
194
+ -underline 3
195
+ .menu.help.m add command -label "On Window..." -command {Help window} \
196
+ -underline 3
197
+ .menu.help.m add command -label "On Keys..." -command {Help keys} \
198
+ -underline 3
199
+ .menu.help.m add command -label "On Version..." -command {Help version} \
200
+ -underline 3
201
+
202
+ # Local Variables:
203
+ # mode: tcl
204
+ # End:
evalkit_llava/lib/tk8.6/demos/search.tcl ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # search.tcl --
2
+ #
3
+ # This demonstration script creates a collection of widgets that
4
+ # allow you to load a file into a text widget, then perform searches
5
+ # on that file.
6
+
7
+ if {![info exists widgetDemo]} {
8
+ error "This script should be run from the \"widget\" demo."
9
+ }
10
+
11
+ package require Tk
12
+
13
+ # textLoadFile --
14
+ # This procedure below loads a file into a text widget, discarding
15
+ # the previous contents of the widget. Tags for the old widget are
16
+ # not affected, however.
17
+ #
18
+ # Arguments:
19
+ # w - The window into which to load the file. Must be a
20
+ # text widget.
21
+ # file - The name of the file to load. Must be readable.
22
+
23
+ proc textLoadFile {w file} {
24
+ set f [open $file]
25
+ $w delete 1.0 end
26
+ while {![eof $f]} {
27
+ $w insert end [read $f 10000]
28
+ }
29
+ close $f
30
+ }
31
+
32
+ # textSearch --
33
+ # Search for all instances of a given string in a text widget and
34
+ # apply a given tag to each instance found.
35
+ #
36
+ # Arguments:
37
+ # w - The window in which to search. Must be a text widget.
38
+ # string - The string to search for. The search is done using
39
+ # exact matching only; no special characters.
40
+ # tag - Tag to apply to each instance of a matching string.
41
+
42
+ proc textSearch {w string tag} {
43
+ $w tag remove search 0.0 end
44
+ if {$string == ""} {
45
+ return
46
+ }
47
+ set cur 1.0
48
+ while 1 {
49
+ set cur [$w search -count length $string $cur end]
50
+ if {$cur == ""} {
51
+ break
52
+ }
53
+ $w tag add $tag $cur "$cur + $length char"
54
+ set cur [$w index "$cur + $length char"]
55
+ }
56
+ }
57
+
58
+ # textToggle --
59
+ # This procedure is invoked repeatedly to invoke two commands at
60
+ # periodic intervals. It normally reschedules itself after each
61
+ # execution but if an error occurs (e.g. because the window was
62
+ # deleted) then it doesn't reschedule itself.
63
+ #
64
+ # Arguments:
65
+ # cmd1 - Command to execute when procedure is called.
66
+ # sleep1 - Ms to sleep after executing cmd1 before executing cmd2.
67
+ # cmd2 - Command to execute in the *next* invocation of this
68
+ # procedure.
69
+ # sleep2 - Ms to sleep after executing cmd2 before executing cmd1 again.
70
+
71
+ proc textToggle {cmd1 sleep1 cmd2 sleep2} {
72
+ catch {
73
+ eval $cmd1
74
+ after $sleep1 [list textToggle $cmd2 $sleep2 $cmd1 $sleep1]
75
+ }
76
+ }
77
+
78
+ set w .search
79
+ catch {destroy $w}
80
+ toplevel $w
81
+ wm title $w "Text Demonstration - Search and Highlight"
82
+ wm iconname $w "search"
83
+ positionWindow $w
84
+
85
+ ## See Code / Dismiss buttons
86
+ set btns [addSeeDismiss $w.buttons $w]
87
+ pack $btns -side bottom -fill x
88
+
89
+ frame $w.file
90
+ label $w.file.label -text "File name:" -width 13 -anchor w
91
+ entry $w.file.entry -width 40 -textvariable fileName
92
+ button $w.file.button -text "Load File" \
93
+ -command "textLoadFile $w.text \$fileName"
94
+ pack $w.file.label $w.file.entry -side left
95
+ pack $w.file.button -side left -pady 5 -padx 10
96
+ bind $w.file.entry <Return> "
97
+ textLoadFile $w.text \$fileName
98
+ focus $w.string.entry
99
+ "
100
+ focus $w.file.entry
101
+
102
+ frame $w.string
103
+ label $w.string.label -text "Search string:" -width 13 -anchor w
104
+ entry $w.string.entry -width 40 -textvariable searchString
105
+ button $w.string.button -text "Highlight" \
106
+ -command "textSearch $w.text \$searchString search"
107
+ pack $w.string.label $w.string.entry -side left
108
+ pack $w.string.button -side left -pady 5 -padx 10
109
+ bind $w.string.entry <Return> "textSearch $w.text \$searchString search"
110
+
111
+ text $w.text -yscrollcommand "$w.scroll set" -setgrid true
112
+ ttk::scrollbar $w.scroll -command "$w.text yview"
113
+ pack $w.file $w.string -side top -fill x
114
+ pack $w.scroll -side right -fill y
115
+ pack $w.text -expand yes -fill both
116
+
117
+ # Set up display styles for text highlighting.
118
+
119
+ if {[winfo depth $w] > 1} {
120
+ textToggle "$w.text tag configure search -background \
121
+ #ce5555 -foreground white" 800 "$w.text tag configure \
122
+ search -background {} -foreground {}" 200
123
+ } else {
124
+ textToggle "$w.text tag configure search -background \
125
+ black -foreground white" 800 "$w.text tag configure \
126
+ search -background {} -foreground {}" 200
127
+ }
128
+ $w.text insert 1.0 \
129
+ {This window demonstrates how to use the tagging facilities in text
130
+ widgets to implement a searching mechanism. First, type a file name
131
+ in the top entry, then type <Return> or click on "Load File". Then
132
+ type a string in the lower entry and type <Return> or click on
133
+ "Load File". This will cause all of the instances of the string to
134
+ be tagged with the tag "search", and it will arrange for the tag's
135
+ display attributes to change to make all of the strings blink.}
136
+ $w.text mark set insert 0.0
137
+
138
+ set fileName ""
139
+ set searchString ""
evalkit_llava/lib/tk8.6/demos/style.tcl ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # style.tcl --
2
+ #
3
+ # This demonstration script creates a text widget that illustrates the
4
+ # various display styles that may be set for tags.
5
+
6
+ if {![info exists widgetDemo]} {
7
+ error "This script should be run from the \"widget\" demo."
8
+ }
9
+
10
+ package require Tk
11
+
12
+ set w .style
13
+ catch {destroy $w}
14
+ toplevel $w
15
+ wm title $w "Text Demonstration - Display Styles"
16
+ wm iconname $w "style"
17
+ positionWindow $w
18
+
19
+ ## See Code / Dismiss buttons
20
+ set btns [addSeeDismiss $w.buttons $w]
21
+ pack $btns -side bottom -fill x
22
+
23
+ # Only set the font family in one place for simplicity and consistency
24
+
25
+ set family Courier
26
+
27
+ text $w.text -yscrollcommand "$w.scroll set" -setgrid true \
28
+ -width 70 -height 32 -wrap word -font "$family 12"
29
+ ttk::scrollbar $w.scroll -command "$w.text yview"
30
+ pack $w.scroll -side right -fill y
31
+ pack $w.text -expand yes -fill both
32
+
33
+ # Set up display styles
34
+
35
+ $w.text tag configure bold -font "$family 12 bold italic"
36
+ $w.text tag configure big -font "$family 14 bold"
37
+ $w.text tag configure verybig -font "Helvetica 24 bold"
38
+ $w.text tag configure tiny -font "Times 8 bold"
39
+ if {[winfo depth $w] > 1} {
40
+ $w.text tag configure color1 -background #a0b7ce
41
+ $w.text tag configure color2 -foreground red
42
+ $w.text tag configure raised -relief raised -borderwidth 1
43
+ $w.text tag configure sunken -relief sunken -borderwidth 1
44
+ } else {
45
+ $w.text tag configure color1 -background black -foreground white
46
+ $w.text tag configure color2 -background black -foreground white
47
+ $w.text tag configure raised -background white -relief raised \
48
+ -borderwidth 1
49
+ $w.text tag configure sunken -background white -relief sunken \
50
+ -borderwidth 1
51
+ }
52
+ $w.text tag configure bgstipple -background black -borderwidth 0 \
53
+ -bgstipple gray12
54
+ $w.text tag configure fgstipple -fgstipple gray50
55
+ $w.text tag configure underline -underline on
56
+ $w.text tag configure overstrike -overstrike on
57
+ $w.text tag configure right -justify right
58
+ $w.text tag configure center -justify center
59
+ $w.text tag configure super -offset 4p -font "$family 10"
60
+ $w.text tag configure sub -offset -2p -font "$family 10"
61
+ $w.text tag configure margins -lmargin1 12m -lmargin2 6m -rmargin 10m
62
+ $w.text tag configure spacing -spacing1 10p -spacing2 2p \
63
+ -lmargin1 12m -lmargin2 6m -rmargin 10m
64
+
65
+ $w.text insert end {Text widgets like this one allow you to display information in a
66
+ variety of styles. Display styles are controlled using a mechanism
67
+ called }
68
+ $w.text insert end tags bold
69
+ $w.text insert end {. Tags are just textual names that you can apply to one
70
+ or more ranges of characters within a text widget. You can configure
71
+ tags with various display styles. If you do this, then the tagged
72
+ characters will be displayed with the styles you chose. The
73
+ available display styles are:
74
+ }
75
+ $w.text insert end "\n1. Font." big
76
+ $w.text insert end " You can choose any system font, "
77
+ $w.text insert end large verybig
78
+ $w.text insert end " or "
79
+ $w.text insert end "small" tiny ".\n"
80
+ $w.text insert end "\n2. Color." big
81
+ $w.text insert end " You can change either the "
82
+ $w.text insert end background color1
83
+ $w.text insert end " or "
84
+ $w.text insert end foreground color2
85
+ $w.text insert end "\ncolor, or "
86
+ $w.text insert end both {color1 color2}
87
+ $w.text insert end ".\n"
88
+ $w.text insert end "\n3. Stippling." big
89
+ $w.text insert end " You can cause either the "
90
+ $w.text insert end background bgstipple
91
+ $w.text insert end " or "
92
+ $w.text insert end foreground fgstipple
93
+ $w.text insert end {
94
+ information to be drawn with a stipple fill instead of a solid fill.
95
+ }
96
+ $w.text insert end "\n4. Underlining." big
97
+ $w.text insert end " You can "
98
+ $w.text insert end underline underline
99
+ $w.text insert end " ranges of text.\n"
100
+ $w.text insert end "\n5. Overstrikes." big
101
+ $w.text insert end " You can "
102
+ $w.text insert end "draw lines through" overstrike
103
+ $w.text insert end " ranges of text.\n"
104
+ $w.text insert end "\n6. 3-D effects." big
105
+ $w.text insert end { You can arrange for the background to be drawn
106
+ with a border that makes characters appear either }
107
+ $w.text insert end raised raised
108
+ $w.text insert end " or "
109
+ $w.text insert end sunken sunken
110
+ $w.text insert end ".\n"
111
+ $w.text insert end "\n7. Justification." big
112
+ $w.text insert end " You can arrange for lines to be displayed\n"
113
+ $w.text insert end "left-justified,\n"
114
+ $w.text insert end "right-justified, or\n" right
115
+ $w.text insert end "centered.\n" center
116
+ $w.text insert end "\n8. Superscripts and subscripts." big
117
+ $w.text insert end " You can control the vertical\n"
118
+ $w.text insert end "position of text to generate superscript effects like 10"
119
+ $w.text insert end "n" super
120
+ $w.text insert end " or\nsubscript effects like X"
121
+ $w.text insert end "i" sub
122
+ $w.text insert end ".\n"
123
+ $w.text insert end "\n9. Margins." big
124
+ $w.text insert end " You can control the amount of extra space left"
125
+ $w.text insert end " on\neach side of the text:\n"
126
+ $w.text insert end "This paragraph is an example of the use of " margins
127
+ $w.text insert end "margins. It consists of a single line of text " margins
128
+ $w.text insert end "that wraps around on the screen. There are two " margins
129
+ $w.text insert end "separate left margin values, one for the first " margins
130
+ $w.text insert end "display line associated with the text line, " margins
131
+ $w.text insert end "and one for the subsequent display lines, which " margins
132
+ $w.text insert end "occur because of wrapping. There is also a " margins
133
+ $w.text insert end "separate specification for the right margin, " margins
134
+ $w.text insert end "which is used to choose wrap points for lines.\n" margins
135
+ $w.text insert end "\n10. Spacing." big
136
+ $w.text insert end " You can control the spacing of lines with three\n"
137
+ $w.text insert end "separate parameters. \"Spacing1\" tells how much "
138
+ $w.text insert end "extra space to leave\nabove a line, \"spacing3\" "
139
+ $w.text insert end "tells how much space to leave below a line,\nand "
140
+ $w.text insert end "if a text line wraps, \"spacing2\" tells how much "
141
+ $w.text insert end "space to leave\nbetween the display lines that "
142
+ $w.text insert end "make up the text line.\n"
143
+ $w.text insert end "These indented paragraphs illustrate how spacing " spacing
144
+ $w.text insert end "can be used. Each paragraph is actually a " spacing
145
+ $w.text insert end "single line in the text widget, which is " spacing
146
+ $w.text insert end "word-wrapped by the widget.\n" spacing
147
+ $w.text insert end "Spacing1 is set to 10 points for this text, " spacing
148
+ $w.text insert end "which results in relatively large gaps between " spacing
149
+ $w.text insert end "the paragraphs. Spacing2 is set to 2 points, " spacing
150
+ $w.text insert end "which results in just a bit of extra space " spacing
151
+ $w.text insert end "within a pararaph. Spacing3 isn't used " spacing
152
+ $w.text insert end "in this example.\n" spacing
153
+ $w.text insert end "To see where the space is, select ranges of " spacing
154
+ $w.text insert end "text within these paragraphs. The selection " spacing
155
+ $w.text insert end "highlight will cover the extra space." spacing