<! Applet definition: This applet defines new function which can run a demo
using the SYSTEM function.
This is VERY DANGEROUS, but user can set security to a given level
when launching the browser.
Security is not yet finished and need some work
This directory contains the demo programs for STk.
There are several categories of demos available from here:
- STk demos: They correspond to
program which don't use CLOS like object extension of
STk. These demo are quite simple and they often mimic
original Tcl/Tk demonstrations
- STklos demos: These
demonstration programs use the STklos object Extension of
STk. The code of most of these demos has been kept short
to illustrate the basic of STklos programming.
- Html demo: This demo is
in fact an overview of STk/STklos that I have used once in a
presentation of STklos. The pages accessible from this link
present STk but also contains links or Scheme applets which
illustrate the kind of things that can be done with the STk
browser. Of course, to properly execute the applets contained
in theses pages, you need to run the STk Html browser
Running demonstration programs without installing STk
If you want to run a demo BEFORE a complete
installation of the STk package, you must use the shell
../Src/test-stk in order to run the
interpreter (this shell script set some variables to run properly
the interpreter without installing it).
Running demonstration programs in the STk web browser
Note: In this document the notation
RUN means that you must type either
../Src/test-stk if you have not completed the
installation of STk, either type stk
(provided that the install location is in your path)
STk provides a simple Web browser which can be used to launch
the demo of this directory. If you are not running it now, you can
type the following command:
RUN -f S-scape README.html
at the shell prompt.
1.1 Basic STk demos
1.2 Basics of STk programming
This is a rewrite of the Tcl/Tk wtour2.0 in Scheme/STk. Use
the menus to navigate through different lessons. You can make
changes to the lesson source code; click on the Apply button
to see the results of the changes.
RUN -f ./wtour.stk ../Contrib/STk-wtour
Comment: This code is a contribution of Suresh Srinivas
1.3 Client/Server Demos
A simple server showing how to use the socket package. It
creates an xterm window in which a read-eval-print-loop is
executed. When the window is closed or when an error occurs,
the socket is closed
RUN -no -f server.stk
A multiple-clients server. On Unix, you can use several telnet
sessions to discuss with the server. Each discussion
has its own dedicated channel. Type (exit) at the STk
when you want to exit the demo.
RUN -load mc-server.stk
1.4 Fun and Games
A Logo turtle package + some demo functions.
RUN -f turtle.stk
Hanoi towers animation.
RUN -f hanoi.stk
The queens problem. You can do it yourself (and it will make
sure you follow the rules) or you can ask it to solve the
puzzle starting with a given board configuration.
RUN -f queens.stk
Comment: This code is a contribution of Grant
This is a falling block game not unlike tetris(tm) :). It is
implemented in STk just to prove it can be done, and as a
challenge to TCLers. It starts slowly and becomes faster and
faster. Have fun.
RUN -f stetris.stk
This code is a contribution of Harvey J. Stein
A 3D Tic-Tac-Toe, where the board is 4x4x4, a 3 dimensional
board of four planes with four rows and four columns each.
RUN -f ttt.stk
This code is a contribution of Edin "Dino" Hodzic
This is a simple demo showing a repl loop in a console.
RUN -f console.stk
Comment: This demo is useful for Unix users only, since under
Win32 STk is started with such a console.
This is a simple color palette written in STk.
RUN -f colormap.stk
Comment: Note that this program is no more really useful since
STk offers now the function Tk:choose-color
which allow to choose a color by name or by value.
This is a simple program which uses the STk font chooser.
RUN -f stkfontsel.stk
A small editor to create enhanced text
RUN -f small-ed.stk
This editor use a ad-hoc format for saving file and was
used for the help buttons of various widgets in old versions
of STk. It will not be developed anymore since the
preferred format for help is now HTML.
A variable shower: this program shows the value of three
variables (named a,b and c) Changing the value of one of
these vars (with a set! for instance) will
redisplay its new value immediately.
RUN -load showvars.stk
A simple demo of the inspector on Tk widgets
RUN -f inspector.stk
Does not work with this version of STk
A new version of the inspector is in practically finished and
will be soon released.
A simple terminal emulator (a kind of xterm, but in a text widget).
RUN -f term.stk
Comment: Users of Glibc2 (aka libc6, or RedHat 5.0
users): This program has problems with new release of the
libc under Linux, if your shell has the line editing mode
set. To avoid the problem you can
- disable the line editing mode of your shell
- set the SHELL variable to a dumb shell (e.g. ash)
- link STk with the old libc
- don't run the demo :-)
All the standard Tk widgets have been wrapped in STklos
classes. As a result, in STklos, Tk widgets are seen as instances of
There are two kinds of STklos widgets:
Demonstration programs accessible from this page use indifferently
simple widgets and composite widgets.
- Simple widgets which map one to one the Tk standard
- Composite widgets which are built from simple Tk
widgets (or even simpler composite widgets).
2.1 Basic STklos demos
This is a simple rewriting of the hello.stk
demonstration in STklos
RUN -f hello.stklos
This is a simple rewriting of the browse.stk
demonstration in STklos
RUN -f browse.stklos
A simple demo written in STklos.
RUN -f stklos-demo.stklos
Comment: What is interesting in this demo is not what
it does, nothing specially fancy, but how it is easy to
Another simple demo written in STklos.
RUN -f stklos-demo2.stklos
Comment: Here again, what is interesting in this demo is not what
it does, nothing specially fancy, but how it is easy to
This demo shows the STklos class browser.
RUN -f classbrowse.stklos
2.2 STklos widgets
A tour of the Tk widgets. This demo shows all the Tk
widgets. This is a rewriting in STklos of the big Tcl/Tk demo
widget.tcl. For each widget demo accessible from this
program, you can see the source by just clicking the "See
code" button. You can modify the code and test your
modified version by clicking the button "Rerun demo"
RUN -f widget.stk
Comment: This demo illustrate only the simple widgets
(the ones of the Tk library). For a composite widgets
demo look at the stklos-widgets.stklos program.
This is a simple program which uses the <File-box>
composite widget. A <File-box> is a file requester
with file name completion (on the Tab key).This widget is
itself a composition of various composite widget classes.
RUN -f filebox.stklos
A quick demo of some of the STklos Composite widgets
which are available in this release.
RUN -f stklos-widgets.stklos
Comment: This code is a contribution of Drew Whitehouse
2.3 STklos Applications
This is a simplistic calculator.
RUN -f calc.stklos
This is a simple color picker written in STklos.
Clicking the left mouse button in the color box sets the text
color to the chosen color. Clicking the right button sets the
background color. The Select button sets the selection
to a string which can be used (by pasting it in an xterm window)
as argument of most X11 applications to set their foreground and
RUN -f tkcolor.stklos
A Mini Interface Builder.
RUN -f amib.stklos
Comment: The current version of AMIB allow you to:
However it is far from a really usable interface builder (but
after all it is only a 600 lines of code application!!!!)
- place objects on a plane by drag and drop
- resize objects
- displace objects
- change all the slots of an object (color, font, value, ...)
- save an interface to reload it later in an application
The STk web browser. You are probably using it while seeing these lines.
RUN -f S-scape.stklos
Last modified: Mon Sep 13 19:59:47 CEST 1999