Improve Gambit REPL (toolbar is semi transparent and the alpha can be set with set...
[gambit-c.git] / examples / tcltk / README
blob9cee7dc4ddb626b1b421663d6de2fc1109e0534b
1 This directory contains a few examples of the Gambit interface to
2 Tcl/Tk.  The examples are mostly translations of the figures in John
3 Ousterhout's book "Tcl and the Tk Toolkit" from Addison-Wesley, 1994.
5 To run an example you must first compile "tcltk.scm" to get "tcltk.o1".
6 Then type "gsi <example>" or "./<example>", for instance:
8   % gsi fig16-1
10 When writing a Scheme program interfacing to Tcl/Tk these rules must
11 be followed.  The file "tcltk.o1" must first be loaded.  The Tcl/Tk
12 application window will appear when the Scheme program attempts to
13 exit (normally or not).  Tcl/Tk commands such as
15   button .b -text OK -command {puts "OK was pressed"}
17 get translated to a Scheme call of this form:
19   (button ".b" text: "OK" command: (lambda () (write "OK was pressed")))
21 Note the use of keywords for option names, and also that Scheme
22 functions can be passed to commands.  Numbers, booleans, and symbols
23 can also be passed to commands.  The result of the Scheme function
24 call is the string that the Tcl/Tk command returns.
26 In certain situations it is necessary to use a widget name as a
27 command.  For example:
29   . configure -background green
31 In this case the Scheme procedure "tcl" must be used:
33   (tcl "." 'configure background: "green")
35 To access Tcl/Tk variables, these procedures can be used:
37   (get-variable "n")
38   (set-variable! "n" "123")
40 To interrupt a Scheme program you cannot send Ctrl-C to the Gambit
41 interpreter.  Instead you should type the function key F10 in one of
42 the Tcl/Tk application windows.
44 For a more detailed description of Tcl/Tk commands, check the quick
45 reference guide "tkref.pdf"