Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Fetching latest commit…

Cannot retrieve the latest commit at this time

..
Failed to load latest commit information.
README
fig16-1.scm
fig16-10.scm
fig16-11.scm
fig16-12.scm
fig16-13.scm
fig16-14.scm
fig16-15.scm
fig16-16.scm
fig16-17.scm
fig16-2.scm
fig16-3.scm
fig16-6.scm
fig16-7.scm
fig16-8.scm
fig16-9.scm
fig17-9.scm
makefile.in
tcltk#.scm
tcltk.scm
test.scm

README

This directory contains a few examples of the Gambit interface to
Tcl/Tk.  The examples are mostly translations of the figures in John
Ousterhout's book "Tcl and the Tk Toolkit" from Addison-Wesley, 1994.

To run an example you must first compile "tcltk.scm" to get "tcltk.o1".
Then type "gsi <example>" or "./<example>", for instance:

  % gsi fig16-1

When writing a Scheme program interfacing to Tcl/Tk these rules must
be followed.  The file "tcltk.o1" must first be loaded.  The Tcl/Tk
application window will appear when the Scheme program attempts to
exit (normally or not).  Tcl/Tk commands such as

  button .b -text OK -command {puts "OK was pressed"}

get translated to a Scheme call of this form:

  (button ".b" text: "OK" command: (lambda () (write "OK was pressed")))

Note the use of keywords for option names, and also that Scheme
functions can be passed to commands.  Numbers, booleans, and symbols
can also be passed to commands.  The result of the Scheme function
call is the string that the Tcl/Tk command returns.

In certain situations it is necessary to use a widget name as a
command.  For example:

  . configure -background green

In this case the Scheme procedure "tcl" must be used:

  (tcl "." 'configure background: "green")

To access Tcl/Tk variables, these procedures can be used:

  (get-variable "n")
  (set-variable! "n" "123")

To interrupt a Scheme program you cannot send Ctrl-C to the Gambit
interpreter.  Instead you should type the function key F10 in one of
the Tcl/Tk application windows.

For a more detailed description of Tcl/Tk commands, check the quick
reference guide "tkref.pdf"
Something went wrong with that request. Please try again.