Version 73 of incr Tcl

Updated 2008-11-17 16:11:53 by LV

[incr Tcl] (the humorous name for the Tcl package "Itcl") is one of the most widely used O-O system for Tcl. The name is a play on C++, and [incr Tcl] provides a similar object model, including multiple inheritence and public and private classes and variables.

While there are over a dozen OO extensions for Tcl, [incr Tcl] is one of the compiled C extensions, which results in better performance than other, all-Tcl object systems.

AK: XOTcl is another compiled OO extension.

[incr Tcl] is a component of some batteries included Tcl distributions, such as Tcl Dev Kit, ActiveTcl, Tclkit and dqkit.

[incr Tcl] is also the foundation of [incr Tk] and the Iwidgets megawidgets. The home page is , and source code is available at

Debugging via trace is slightly more complex than for plain Tcl Itcl trace.

The script level commands made available by the itcl extension are:

See for more doc references.

Marty Backe posted an apt testimonial to comp.lang.tcl: "I've been using Iwidgets for awhile now, and recently completed a project that was fully implemented in itcl (including Iwidgets). I'm converted. Once you write a program based on objects, you might be hard pressed to go back to the straight tcl way. It becomes VERY easyto write clear, concise code. Of course you can do the same with namespaces (that's what I've been doing), but it takes a lot more work, and the result isn't as satisfying (IMHO).

My current approach is to have one file that contains the main application, which primarily creates objects via class files sourced from a class/ directory. Each object is defined in one class file. This facilitates testing of the objects prior to integration into the application.

Arguably, Itcl is probably one of the most mature extensions available for Tcl. I think that should be your least concern.

Michael McLennan pointed out on the Incr Tcl Users' mailing list that you can create auto-load index files for Incr Tcl packages, so that class files only get sourced as needed. (Lazy loading.)

    $ tclsh
    % package require Itcl
    % cd /dir/containing/tcl/files
    % auto_mkindex . *.tcl *.itcl *.itk

Note that the trick for making Itcl index files is just to load Itcl before calling auto_mkindex. That way, it will recognize your itcl::class definitions and add them to the index.

In the past, there were web pages and an old porting guide for itcl on the web site. That site does not seem to respond any longer. Also, a lot of the same information from the web site used to be found at . However, it has not changed for quite some time.

The itcl3.2 source distribution does have information on porting from 2.2 to 3.2. See these two files:


The latest version of Itcl from the CVS appears to be version 3.3 . A beta and release candidate download of this code is now available from the sourceforge project page.

A TIP was passed to include the code for itcl in the tcl core tar file, but as an extension which one can load or not depending on the need. Options for getting itk and Iwidgets seperately were planned quite a long time ago, but activity relating to this extension appears to be low - watch for more details. Alas, no one who likes itcl has stepped forward to implement this action.

Note - it appears that when building incr tcl from source, one needs to install before doing the test suite. That rather is annoying - one must overwrite one's current installation before testing a patch to see if the resulting extension even works ...

Persistent incr-Tcl objects describes how to add the capability to write out a script which will restore the state of the objects in a program at a later date. This is also refered to as the serialisation of objects.

 What: tydoc
 Description: A part of Tycho, tydoc takes itcl source code and generates html.
        Expects you to maintain classes and procs in separate files.
        Does not generate an entire source tree recursively - you provide
        the specific file names that you want doc generated.  Has a few
        javadoc like tags.
 Updated: 11/2005
 Contact: (Christopher Brooks)

An archive for the distributed processing incr tcl discussion may be found at gopher:// .

A WWW page describing an incr tcl widget base class can be found at . It is by mailto:[email protected] (Nat Pryce).

Information about the use of Tcl and incr Tcl during prototyping of the Mars PathFinder project can be found at .

At an interesting paper resides regarding an interactive tool using incr tcl/incr tk to aid in proposal preparation for the Hubble Space Telescope.

At , the author of the Tea OO Tcl extension provides a comparison between Tea and incr tcl.

A mailing list for users of itcl is managed at the sourceforge project site. It is, however, nearly comotose.

A mailing list for the incr tcl distributed version - aka Distinct - can be joined by sending send a message to mailto:[email protected] where the body contains the line

        join distinct firstname lastname

To send to the list, mail mailto:[email protected] .

Some applications which make use of incr tcl include:

 What: ADAM (Affordable Desktop Application Manager)
 Description: A itcl package which can be used to organize the applications
        on your desktop.
 Updated: 09/1996
 Contact: mailto:[email protected]

 What: AutoDOC
 Description: Automatic man page HTML documentation for C++ classes.
        Requires itcl 2.2.
 Updated: 09/1997
 Contact: mailto:[email protected] (Joerg Reiberg)

 What: boob
 Where: From the contact
 Description: Tool Object oriented objection builder which manages SCM builds
        and repository duties. Written in itcl and uses itcl files
        as dependencies and build scripts.  Rules based dependencies with
        on the fly scanning of c/c++ files.
 Updated: 10/1998
 Contact: mailto:[email protected] (Bob McWhirter)

 What: CC2Itcl
 Description: Generate bindings to get C++ classes integrated into Itcl.
 Updated: 02/2000
 Contact: Unknown

 What: cpp2itcl
 Where: From the contact
 Description: Program to parse C++ header files and automaticallty
        extract C++ bindings.
 Contact: mailto:[email protected] (Karel Zuiderveld)

 What: HTCLtoTCL
 Description: Extracts Tcl from HTML/Tcl merged file.  Requires [incr tcl]/itcl.
        Also has contains program which parses arguments passed by httpd
        type server from FORM input.
 Contact: mailto:[email protected]  (Case Larsen)

 What: InfoPrism
 Description: A general document processing system that translates SGML
        comforming to the InfoPrism DTD to different output formats,
        such as HTML, Texinfo, LaTeX and plain text.  Latest
        version now supports SGML scripts - that is, microscripted
        SGML documents (with embedded Tcl code that gets processed
        in a preprocessor manner).
        Uses itcl 3.0, an SGML parser (such as sgmls v1.1.91 and nsgmls v1.1.1),
        and Jultaf library v0.0.9 or newer.  It uses the GPL.
        At this time it is alpha quality.
 Updated: 04/1999
 Contact: mailto:[email protected] (Stefan Hornburg)

 What: knews
 Description: Proof of concept NNTP server written in itcl.
 Updated: 05/2000
 Contact: mailto:[email protected]

 What: moonshine
 Description: Source code editor which recognizes most of the Tcl/Tk, Itcl,
        and Expect commands.  Has customizable syntax highlighting
 Updated: 02/2000
 Contact: mailto:[email protected]

 What: newsflash
 Description: A NNTP newsreader written using Tcl/Tk.  It has article
        threading, multiple newsrc files, article decoding.  It does
        not yet support killfiles, moderated newsgroup posting, email
        replies, multi-article save/uudecode, searching, or documentation.
        Requires Tcl 7.4/Tk 4.0, BLT 1.7, [incr tcl] 1.5 and
        tcl-dp 3.2.
 Updated: 02/1997
 Contact: mailto:[email protected] (Koert Zeilstra)

 What: nntp server
 Description: A proof-of-concept NNTP server (written in Itcl).
 Updated: 06/2000
 Contact: mailto:[email protected]


 What: Point repulsion demonstration
 Description: Two C++ programs designed to answer the question of how
        to distribute N points on a spere and how to tesselate a sphere.
        Uses Tk and itcl to display results.
 Contact: mailto:[email protected] (Jon Leech)

 What: Qba
 Description: Qba is the Qddb Business Application.  It provides a Qddb/Fx
        interface for managing clients, inventory, invoices, payments, and
        the like.  Requires Tcl 7.4/Tk 4.0/itcl-1.5/BLT 1.8/Tix 4.0/Qddb-1.42.6
        and tktable.
 Updated: 04/1997
 Contact: mailto:[email protected] (Qba author)
        mailto:[email protected] (Qddb mailing list)

 What: Qddb
 Description: A Quick and Dirty DataBase (Qddb) package.  It uses Tcl as a
        configuration language.  Also has a Tk interface with TkTable extension.
        qhelp is a sample hypertext help system.
        Under the qddb/applications web site listed above are a set of
        example applications such as a Web guestbook, an address book,
        music albums tracking system,
        runner's log, recipe management system, bug tracker, client
        information database, and animal hospital software package.
        Supports Tk 4.2/itcl 2.2.  Requires itcl, BLT 2.1 and tclX is
        recommended.  Also supports Tix.
        While at one time this was free, it apparently is now commercial.
        Currently at version 2.0.0 .
 Updated: 09/2001
 Contact: mailto:[email protected] (Qddb user mailing list)
        mailto:[email protected] (Qddb bugs only)

 What: TSIPP Work Bench
 Description: A point-and-click editor for 3D pictures and animations.
    Originally targeted at the software rendering engine TSIPP developed
    by Mark Diekhans, but is in the process of being enhanced to drive
    OpenGL using the TkOGL package by Claudio Esperanca.
 Updated: 08/2002
 Contact: mailto:[email protected] (Paul Welton)

 What: [incr Tcl] class browser
 Description: A very simple iTcl graphical class browser.
        V1.2 is now available from the contact.
 Updated: 10/1998
 Contact: mailto:[email protected] (Drew J. Asson) ???

Add on classes for incr tcl include

(JULY 28, 2003)

I'm interested in learning about iTCL, what is the best source for a tutorial? I would greatly appreciate any input...


lv did you read here on the wiki about incr tcl? The book about incr tcl is the best tutorial there is; alas, incr tcl, like tclx, as well as a number of other quite widely used extensions, do not seem as widely documented as they could be. And the book may be difficult to locate.

Googie - Some ideas for writing one's own Pure-Itcl widgets (no itk).


I'm learning Itcl and enjoy reading the well-written two chapters in the Tools book.

But I'm new at it and have a question. Even a good teacher has students who need raise their hand once in a while.

My confusion is about the DELETE code.

Itcl, it says, is designed to follow the tk paradigm.

On page 9 the delete statement reads:

$canvas delete $this

On page 12, however, the delete looks structurally different:

delete object bullet1

What am I missing?

Much obliged, and thanks.

I don't have access to the book, but '$canvas delete $this' looks to be a standard tk command. $canvas represents a canvas widget and $this represents something drawn on the canvas. Therefore, that statement is simply deleting something from the canvas widget. The 'delete object bullet1' is an itcl command, deleting the itcl object 'bullet1'

RLH 20060401: I see a lot of mention about XOTcl and Snit when the OO debate comes up but little about incr Tcl. Is it still actively maintained?

FPX 20080306: Yes. [incr Tcl] is very stable and robust, and it is still actively maintained to work with the latest versions of Tcl. Its Web presence may not always be up to date, but the code base in CVS is.

FPX 20080306: [incr Tcl] 3.4 is required with Tcl 8.5 and later. At the moment, this version is not available from the [incr Tcl] homepage. You will need to use CVS to download the latest code as described on or you can get the latest package from -- itcl-20080207.tar.gz worked for me.

See also