3 ; This demo shows how to write Tcl/Tk GUIs
4 ; controlled from newLISP
6 ; newlisp-tk is not required, only newlisp
7 ; and a Tcl/Tk installation
10 ; setup communications
12 (map set
'(myin tcout
) (pipe))
13 (map set
'(tcin myout
) (pipe))
15 (process "/usr/bin/wish" tcin tcout
)
22 wm title . "Tcl/Tk and newLISP"
24 button .one -text {red}
25 button .two -text {green}
26 button .three -text {blue}
27 label .colorlabel -width 25
29 grid .one .two .three -padx 8 -row 0
30 grid .colorlabel -column 0 -columnspan 3 -pady 6
32 .one config -command {puts {(call-back "red")}}
33 .two config -command {puts {(call-back "green")}}
34 .three config -command {puts {(call-back "blue")}}
36 bind . <Destroy> {puts {(exit)}}
39 (define (call-back color
)
40 (write-line (append ".colorlabel config -background " color
) myout
)
46 (while (read-line myin
)
47 (eval-string (current-line)))