Top Banner
Tcl and Tk Michael U. Ang
37

Tcl and Tk Michael U. Ang. history and purpose How it started originally intended to be a reusable command language. After implementing several such.

Dec 21, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Tcl and Tk Michael U. Ang. history and purpose How it started originally intended to be a reusable command language. After implementing several such.

Tcl and Tk

Michael U. Ang

Page 2: Tcl and Tk Michael U. Ang. history and purpose How it started originally intended to be a reusable command language. After implementing several such.

history and purpose

Page 3: Tcl and Tk Michael U. Ang. history and purpose How it started originally intended to be a reusable command language. After implementing several such.

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.

Page 4: Tcl and Tk Michael U. Ang. history and purpose How it started originally intended to be a reusable command language. After implementing several such.

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.

Page 5: Tcl and Tk Michael U. Ang. history and purpose How it started originally intended to be a reusable command language. After implementing several such.

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

Page 6: Tcl and Tk Michael U. Ang. history and purpose How it started originally intended to be a reusable command language. After implementing several such.

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.

Page 7: Tcl and Tk Michael U. Ang. history and purpose How it started originally intended to be a reusable command language. After implementing several such.

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.

Page 8: Tcl and Tk Michael U. Ang. history and purpose How it started originally intended to be a reusable command language. After implementing several such.

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.

Page 9: Tcl and Tk Michael U. Ang. history and purpose How it started originally intended to be a reusable command language. After implementing several such.

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.

Page 10: Tcl and Tk Michael U. Ang. history and purpose How it started originally intended to be a reusable command language. After implementing several such.

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

Page 11: Tcl and Tk Michael U. Ang. history and purpose How it started originally intended to be a reusable command language. After implementing several such.

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

Page 12: Tcl and Tk Michael U. Ang. history and purpose How it started originally intended to be a reusable command language. After implementing several such.

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

Page 13: Tcl and Tk Michael U. Ang. history and purpose How it started originally intended to be a reusable command language. After implementing several such.

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.

Page 14: Tcl and Tk Michael U. Ang. history and purpose How it started originally intended to be a reusable command language. After implementing several such.

Important Features

strengths & weaknesses

Page 15: Tcl and Tk Michael U. Ang. history and purpose How it started originally intended to be a reusable command language. After implementing several such.

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

Page 16: Tcl and Tk Michael U. Ang. history and purpose How it started originally intended to be a reusable command language. After implementing several such.

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

Page 17: Tcl and Tk Michael U. Ang. history and purpose How it started originally intended to be a reusable command language. After implementing several such.

Cont… Features

7. Flexible integration easy to coordinate existing components and

applications so that they work together effectively.

8. BONUS: It's free!

Page 18: Tcl and Tk Michael U. Ang. history and purpose How it started originally intended to be a reusable command language. After implementing several such.

Drawback

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

Page 19: Tcl and Tk Michael U. Ang. history and purpose How it started originally intended to be a reusable command language. After implementing several such.

Tcl Comparison Chart

Page 20: Tcl and Tk Michael U. Ang. history and purpose How it started originally intended to be a reusable command language. After implementing several such.

Features Tcl Perl PythonJava 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

Page 21: Tcl and Tk Michael U. Ang. history and purpose How it started originally intended to be a reusable command language. After implementing several such.

Sample Programs

Page 22: Tcl and Tk Michael U. Ang. history and purpose How it started originally intended to be a reusable command language. After implementing several such.

• 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!"}]

Page 23: Tcl and Tk Michael U. Ang. history and purpose How it started originally intended to be a reusable command language. After implementing several such.
Page 24: Tcl and Tk Michael U. Ang. history and purpose How it started originally intended to be a reusable command language. After implementing several such.
Page 25: Tcl and Tk Michael U. Ang. history and purpose How it started originally intended to be a reusable command language. After implementing several such.
Page 26: Tcl and Tk Michael U. Ang. history and purpose How it started originally intended to be a reusable command language. After implementing several such.

Scollbar

Page 27: Tcl and Tk Michael U. Ang. history and purpose How it started originally intended to be a reusable command language. After implementing several such.

Applications written in Perl

Page 28: Tcl and Tk Michael U. Ang. history and purpose How it started originally intended to be a reusable command language. After implementing several such.

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.

Page 29: Tcl and Tk Michael U. Ang. history and purpose How it started originally intended to be a reusable command language. After implementing several such.

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.

Page 30: Tcl and Tk Michael U. Ang. history and purpose How it started originally intended to be a reusable command language. After implementing several such.

Url’s and Books

Page 31: Tcl and Tk Michael U. Ang. history and purpose How it started originally intended to be a reusable command language. After implementing several such.

• 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!

Page 32: Tcl and Tk Michael U. Ang. history and purpose How it started originally intended to be a reusable command language. After implementing several such.

• 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.

Page 33: Tcl and Tk Michael U. Ang. history and purpose How it started originally intended to be a reusable command language. After implementing several such.

• 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

Page 34: Tcl and Tk Michael U. Ang. history and purpose How it started originally intended to be a reusable command language. After implementing several such.

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

Page 35: Tcl and Tk Michael U. Ang. history and purpose How it started originally intended to be a reusable command language. After implementing several such.

Books

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

• Practical Programming in Tcl and Tk (4th ed), by Brent Welch, (Prentice Hall PTR, June 2003)

GETncm/justsaycust-recrate-itemcommunittg/stores/dtg/stores/d-favorite-listruejust-say-no

Page 36: Tcl and Tk Michael U. Ang. history and purpose How it started originally intended to be a reusable command language. After implementing several such.

Cont… Books

• Tcl/Tk: A Developer's Guide (2nd ed), by Clif Flynt (Morgan Kaufmann; May 2003 )

Page 37: Tcl and Tk Michael U. Ang. history and purpose How it started originally intended to be a reusable command language. After implementing several such.

The End