Updated 2012-09-07 09:39:21 by RLE

Arjen Markus (16 march 2005) While tclkit comes with Itcl out-of-the-box, it does not include Itk or Iwidgets. So to wrap an application that uses Iwidgets I needed to copy all the relevant script files and binary libraries into the app-xxx directory.

But there was a further complication: I had Itcl etc. version 3.2 as part of my Tcl distribution, tclkit comes with Itcl 3.3! This made Itk complain ... and I know of no way to drop a (binary) package ...

The solution is a bit tricky:

  • Create a child interpreter
  • Load Itcl 3.2, Itk 3.2 and Iwidgets 4.0.2 (those seem to match) into the child interpreter

That made the starkit start and complain about the creation of the tabnotebook rather than about the incompatible versions of the various packages. One down, one to go.

I do not know why, but for some reason I needed to source two *.itk files explicitly - and then it worked!

The code below is embellished a bit, but this is what I use to start the application instead of the original script (called "interface.tcl"):
 # Trick to force tclkit to use Itcl 3.2 instead of 3.3
 package provide app-interface 1.0

 set scriptname [info script]
 set libname    [file dirname [info script]]
 set applib     [file dirname [file dirname [info script]]]
 set startup [string map [list SCRIPT $scriptname APP $applib LIBX $libname] {
     package require Tk
     lappend auto_path APP
     set env(ITCL_LIBRARY) LIBX
     set env(ITK_LIBRARY) LIBX
     package require -exact Itcl 3.2
     package require -exact Itk 3.2
     package require -exact Iwidgets 4.0.2
     source [file join [file dirname SCRIPT] "Archetype.itk"]
     source [file join [file dirname SCRIPT] "Widget.itk"]
     source [file join [file dirname SCRIPT] "interface.tcl"]

 interp create INTERFACE
 interp eval INTERFACE $startup 


  • I needed to adjust the pkgIndex.tcl file for the application to load via the new file instead of "interface.tcl"
  • I need to require the exact package versions, because otherwise Itcl 3.3 is picked up again.

dqkit includes IWidgets

Eric Amundsen 03/16/05 as does Kitten, which can be a lot to haul around. However, I have had good luck unwrapping the Kitten and just taking the pieces I need and wrapping it all back up again.

Cyan Ogilvie After some playing around I got Itk 3.3 working in tclkit by copying in the lib dir and adding "set ::env(ITK_LIBRARY) $dir" at the top of the pkgIndex.tcl. This seems to be what kitten does to get it to work.