Here are a couple of links to get you started:
http://www.tcl.tk/
http://tcl.sourceforge.net/
http://aspn.activestate.com/ASPN/Tcl
What if I need a tutor?
There is an interactive tutorial program located at:
http://www.msen.com/~clif/TclTutor.html
Why Tcl/Tk?
http://www.tcl.tk/about/
Assignment 1.0
List 5 reasons to choose Tcl/Tk:
1.-
2.-
3.-
4.-
5.-
What about some history?
http://www.tcl.tk/about/history.html
Assignment 1.1
Who is the father of Tcl?
The birth of Tcl?
The birth of Tk?
Enough already! When do we start?
We can start when you have all the software installed. By this time
you should already know where to get the software if it is not already installed.
After you have the software installed, from a prompt, type in wish (press
enter). You should get the wish prompt up. If you are using a
non unix operating system, you will normally have an icon to start wish.
(I am running RedHat http://www.redhat.com/ with the Gnome desktop http://www.gnome.org/
for the development of this book.)
wish what?
wish stands for "windowing shell". wish executes Tcl commands as soon as they are entered, and displays Tk widgets in its own display window.
Assignment 1.2
How can this instant interaction with wish help in application development?
So I've got wish, now what?
Let's jump into writing some commands into your expensive calculator (your computer) and the interactive Tcl/Tk windowing shell. Try typing in these commands, then we will examine exactly what is going on. (If you have trouble with the "echo" command causing wish to freeze then try using the "put" command instead.)
set x 5
set y 6
echo x*y
echo $x*$y
echo expr x*y
expr $x*$y
echo [expr $x*$y]
Assignment 1.3
What do you think the set command does?
What is the purpose of the $ sign?
What do you think the echo command does?
What do you think the expr command does?
What do you think the difference is between the command "expr x*y" and
"echo [expr $x*$y]"?
Why did we put expr inside [ ] brackets?
Items between [ ] brackets are used for commands.
Is expr a work horse?
Yes it is. The command expr returns the evaluation of the given arguments. The expr is one of the most useful commands since it takes arguments with mathematical operators. Some of the mathematical operators that we will be using are as follows in there order of precedence:
Multiplication, Division, Remainder *, /, %
Addition, Subtraction +, -
Boolean comparisons less than, greater than, less than or equal, greater than
or equal <, >, <=, >=
Boolean tests for equality ==, !=
In general, this precedence follows the basic mathematical order of operations including parenthesis for grouping.
Assignment 1.4
Now that you are up to speed on expr find the answers to the following problems
using the given values for x and y (don't forget the $ signs):
x+y x%y x/y x*y
x=2
y=5 _____ _____ _____ _____
x=7
y=2 _____ _____ _____ _____
x=13
y=10 _____ _____ _____ _____
x%(x+y) (x%y)+2 (x/y) +y x-(x*y)
x=2
y=3 _____ _____ _____ _____
x=7
y=4 _____ _____ _____ _____
x=3
y=10 _____ _____ _____ _____
What did you find interesting from this exercise?
What can you say about substitution at this point? (Think $ signs.)