|
Demo directory
Content
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
(see below).
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
script ../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
-
wtour.stk
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 with:
RUN -f ./wtour.stk ../Contrib/STk-wtour
Comment: This code is a contribution of Suresh Srinivas
<ssriniva@cs.indiana.edu>
1.3 Client/Server Demos
-
server.stk
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 with:
RUN -no -f server.stk
-
mc-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 with:
RUN -load mc-server.stk
1.4 Fun and Games
-
turtle.stk
A Logo turtle package + some demo functions.
Run with:
RUN -f turtle.stk
-
hanoi.stk
Hanoi towers animation.
Run with:
RUN -f hanoi.stk
-
queens.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 with:
RUN -f queens.stk
Comment: This code is a contribution of Grant
Edwards <grante@rosemount.com)>
-
stetris.stk
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 with:
RUN -f stetris.stk
Comment:
This code is a contribution of Harvey J. Stein
<hjstein@math.huji.ac.il>
-
ttt.stk
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 with:
RUN -f ttt.stk
Comment:
This code is a contribution of Edin "Dino" Hodzic
<ehodzic@scu.edu>
1.5 Misc
-
console-demo.stk
This is a simple demo showing a repl loop in a console.
Run with:
RUN -f console.stk
Comment: This demo is useful for Unix users only, since under
Win32 STk is started with such a console.
-
colormap.stk
This is a simple color palette written in STk.
Run with:
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.
-
stkfontsel.stk
This is a simple program which uses the STk font chooser.
Run with:
RUN -f stkfontsel.stk
-
small-ed.stk
A small editor to create enhanced text
Run with:
RUN -f small-ed.stk
Comment:
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.
-
showvars.stk
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 with:
RUN -load showvars.stk
-
inspector.stk
A simple demo of the inspector on Tk widgets
Run with:
RUN -f inspector.stk
Comment:
Does not work with this version of STk
A new version of the inspector is in practically finished and
will be soon released.
-
term.stk
A simple terminal emulator (a kind of xterm, but in a text widget).
Run with:
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
STklos classes.
There are two kinds of STklos widgets:
- Simple widgets which map one to one the Tk standard
widgets
- Composite widgets which are built from simple Tk
widgets (or even simpler composite widgets).
Demonstration programs accessible from this page use indifferently
simple widgets and composite widgets.
2.1 Basic STklos demos
-
hello.stklos
This is a simple rewriting of the hello.stk
demonstration in STklos
Run with:
RUN -f hello.stklos
-
browse.stklos
This is a simple rewriting of the browse.stk
demonstration in STklos
Run with:
RUN -f browse.stklos
-
stklos-demo.stklos
A simple demo written in STklos.
Run with:
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
program, IMHO.
-
stklos-demo2.stklos
Another simple demo written in STklos.
Run with:
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
program, IMHO.
-
classbrowse.stklos
This demo shows the STklos class browser.
Run with:
RUN -f classbrowse.stklos
2.2 STklos widgets
-
widget.stklos
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 with:
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.
-
filebox.stklos
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 with:
RUN -f filebox.stklos
-
stklos-widgets.stklos
A quick demo of some of the STklos Composite widgets
which are available in this release.
Run with:
RUN -f stklos-widgets.stklos
Comment: This code is a contribution of Drew Whitehouse
<Drew.Whitehouse@anu.edu.au>.
2.3 STklos Applications
-
calc.stklos
This is a simplistic calculator.
Run with:
RUN -f calc.stklos
-
tkcolor.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
background color.
Run with:
RUN -f tkcolor.stklos
-
amib.stklos
A Mini Interface Builder.
Run with:
RUN -f amib.stklos
Comment: The current version of AMIB allow you to:
- 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
However it is far from a really usable interface builder (but
after all it is only a 600 lines of code application!!!!)
-
S-scape.stklos
The STk web browser. You are probably using it while seeing these lines.
Run with:
RUN -f S-scape.stklos
Erick Gallesio
Last modified: Mon Sep 13 19:59:47 CEST 1999
|