Tcl and Tk presentation

mewstennisSoftware and s/w Development

Nov 4, 2013 (3 years and 9 months ago)

81 views

Tcl
and
Tk

Michael U. Ang

history and purpose

How it started


originally intended to be a reusable command
language.


After implementing several such "quick
-
and
-
dirty" command languages and experiencing
problems with each one,


Then decided to concentrate on implementing a
general
-
purpose, robust command language
that could easily be integrated into new
applications. Thus Tcl (Tool Command
Language) was born.

How it started


Tcl is used in combination with the Tk ("Tool
Kit") library, a set of commands and procedures
that make it relatively easy to program graphical
user interfaces in Tcl.

What is Tcl?


developed by John Ousterhout


(
OH
-
stir
-
howt)
at UC Berkeley.


Tcl stands for “tool command
language”


interpreted scripting language;


most commonly used to build
graphical interfaces in conjunction
with Tk.


everything is text

Cont… What is Tcl?


Tcl programs are simply scripts consisting of Tcl
commands that are processed by a Tcl
interpreter at run time.


example use of Tcl: to build a graphical interface
that displays the output of a C command, and/or
controls the parameters to the C command.

Cont… What is Tcl?


The Tcl interpreter has been ported from UNIX
to DOS, Windows, OS/2, NT, and Macintosh
environments.


The Tk toolkit has been ported from X Window
to Windows and Macintosh.


What is Tk?


A graphical toolkit that gives one access to many
of the graphics primitives of the underlying
windowing system, as well as providing access
to many types of widgets, such as buttons,
scrollbars, menus, and text boxes.


a set of commands and procedures that make it
relatively easy to program graphical user
interfaces in Tcl.


Tk defines Tcl commands that let you create and
manipulate user interfaces.

What is wish?


wish is an interpreter that one can use that:



1) interprets Tcl commands, and



2) interprets Tk commands.


wish provides access to the combined
functionality of Tcl/Tk.

Versions


Tcl/Tk 8.4.4 is the recent stable release version.
released on July 22, 2003

Tcl/Tk 8.4



latest stable release of Tcl/Tk



highly compatible with Tcl 8.3 through Tcl 8.1



introduces new core widgets, significant
performance enhancements, numerous
command enhancements and improved 64
-
bit
integer and file system support

Tcl/Tk 8.3



compatible with Tcl 8.2 and Tcl 8.1



added many new features to Tk based on the
Dash

patch and
Img

patch


previous stable release, 8.3.5, was released on
Oct 18, 2002

Tcl/Tk 8.2



updated the build process to the new Tcl
Extension Architecture. The new features are
primarily at the C
-
level APIs to support new
extensions. There are also new regular
expression C APIs to support Expect.



eliminated minor bugs left over from the 8.1
release

Cont… Versions

Tcl/Tk 8.1



was a major overhaul of Tcl/Tk.



new support for Unicode and internationalized
applications



adds thread
-
safety to the C implementation,
and an all new regular expression package that
adds Advanced Regular Expressions

Tcl/Tk 8.0



one of the widely used release



added an on
-
the
-
fly byte
-
code compiler



added improved cross
-
platform look and feel;
and a menubar facility and a platform
-
neutral
font naming system



last patch release was 8.0.5

Cont… Versions

Looking forward


Tcl/Tk 9.0 represents the next giant step for core
development. Relatively few new features will be
introduced in 9.0; instead, development will
focus on rationalization and refactorization of the
C API's and Tcl commands, and modularization
of the core itself.


9.0 does not currently have a release date.


Important Features

strengths & weaknesses

1. Easy to learn


Tcl/Tk is a very simple language.


2. Standard syntax


once users know Tcl, they will be able to issue
commands easily to any Tcl
-
based application.


3. Graphical user interfaces


Tcl’s TK toolkit.


4. Cross
-
platform applications


the same Tcl script can run on any platform, hence it
provides an excellent management and integration
tool for mixed environments.

Features

5.
Rapid development


gets their job done faster.


Development is fast because of the rapid turnaround;
there is no waiting for long compilations


6. Extensible applications/Embedable


easy to incorporate Tcl into an application


the Tcl interpreter (a library of C procedures) was
designed to be embedded in a variety of applications.

Cont… Features

Cont… Features

7. Flexible integration


easy to coordinate existing components and
applications so that they work together effectively.


8. BONUS: It's free!

Drawback


As the application gets larger, Tcl/Tk code becomes
more and more difficult to understand, maintain and
extend.

Tcl Comparison Chart

Features

Tcl

Perl

Python

Java

Script

Visual

Basic

Speed of use

Rapid development

Flexible, rapid evolution

Great regular expressions





Breadth of
functionality

Easily extensible





Embeddable







Easy GUIs





Internet and Web
-
enabled

Enterprise usage

Cross platform



Internationalization support

Thread safe



Database access

Sample Programs


This shows a Hello button on the Main window.


When you click the button the console window
will display the string "Hello World!" on the
console.



button command creates an instance .b button
called .hello.


-
text string shows the button title.


-
command string is the command responsed to
the button's action.


pack command layouts the button on the
window.

Hello World

pack [button .b
-
text "Hello"
-
command {puts "Hello World!"}]

Scollbar

Applications written in Perl

AOLserver


is America Online's Open
-
Source web server.


a multithreaded, Tcl
-
enabled web server used for large
scale, dynamic web sites.


AOL's Digital City


US’s largest and most popular local city resource.


uses a Tcl interpreter in each of the back
-
end host
processes that provide services to Digital Citys visitors


Every Web page in the Digital City network is generated
by an embedded Tcl script.

Cisco’s ATS

(Automated Test System)


composed of several tools and libraries based on Tcl
that provide support for writing and executing automated
test scripts. Tcl is incorporated in the ATS interpreter to
generate libraries that simplify the task of controlling
remote devices from automated test scripts.

Cygnus's Source
-
Navigator


It extracts information from existing C, C++, Tcl, [incr Tcl],
FORTRAN, Cobol, and assembly programs and uses
this information to build project databases.


Source
-
Navigator is developed in Tcl, with about 95% of
the code in Tcl and the rest in C.

Url’s and Books


www.tcl.tk

or
http://tcl.activestate.com/

--

Main site where you can find the distribution codes,
manual pages and documentations, and other relevant
informations regarding the Tcl/Tk product line.


http://www.neosoft.com/tcl/

--

Home Page for the Official Tcl/Tk Contributed Sources
Archive!



http://incrtcl.sourceforge.net/itcl/

--

provides the extra language support needed to build
large Tcl/Tk applications.

--

introduces the notion of objects, which act as building
blocks for an application.


http://www.activestate.com/Products/ActiveTcl/

--

The industry
-
standard Tcl distribution for HP
-
UX, Linux,
Solaris, and Windows.

--

free



System Requirements for Active Tcl

Solaris



:: sparc architecture only



:: Minimum Solaris 2.6


HP
-
UX



:: PA
-
RISC



:: Minimum HP
-
UX 11

Windows Systems:

:: x86 architecture only


:: Win2K,ME or XP: No additional req



:: WinNT 4.0, 98: Internet Explorer 5+





:: WinNT 4.0: Service Pack 5+




Linux Systems:



:: IX
-
86



:: Minimum 2.0 kernel

Visual Tcl


http://vtcl.sourceforge.net/

--

FREEWARE; currently available:
Version 1.6.0b2


--

supports UNIX, Windows, Macintosh and AS400

--

written entirely in Tcl/Tk and generates pure Tcl/Tk code

--

originally written by Stewart Allen, but development has
been taken over by Christian Gavin and Damon
Courtney

Books


Tcl and the Tk Toolkit
,
by John K. Ousterhout
(Addison
-
Wesley, April
1994)




Practical Programming
in Tcl and Tk (4
th

ed)
, by
Brent Welch, (Prentice
Hall PTR, June 2003)


GET
n
cm/justsay
cust-rec
rate-item
communit
tg/stores/d
tg/stores/d
-
favorite-lis
true
just-say-no
Cont… Books


Tcl/Tk: A Developer's
Guide (2
nd

ed),

by Clif
Flynt (Morgan Kaufmann;
May 2003 )


The End