Equi4 SoftwareTclkit

top pageS






Tclers' Wiki



Contact info

so you want to use starkits, eh?

The very first time you read about Starkits and Tclkits, you may feel ovewhelmed. So how does one get started on this? Here's a quick example, which takes Keith Vetter's Fractal Mountains demo as starting point and explains how to modify it.


  • You're using Windows, Linux, or Mac OS X (with X11)
  • You're a developer and familiar with Tcl, Tk, and the command line
  • You're trying to decide whether to use Starkits for your own Tcl/Tk code

get three files

You will need Tclkit. Get the one matching your platform from the download area.

The Linux and Mac binaries need to be unpacked, renamed, and made runnable:

    gzip -d tclkit-*.gz
    mv tclkit-* tclkit
    chmod +x tclkit

Now download the Fractal Mountains demo from http://mini.net/sdarchive/fractal.kit

Test it, by running "tclkit fractal.kit". You will see a neat little Tk-based demo.

Last step is to get SDX, the Starkit Developer eXtension which contains a few small tools which make it easy to wrap and unwrap starkits and starpacks. Get SDX from http://www.equi4.com/pub/sk/sdx.kit - it's a starkit, you can try it with "tclkit sdx.kit".

you now have the technology

As you saw, tclkit + fractal.kit is enough to run a small Tcl.Tk application. Now let's take it apart - type:

    tclkit sdx.kit unwrap fractal.kit

You will get a directory called "fractal.vfs". It has "fractal.vfs/main.tcl" - which is what always needs to run first to start up. And a directory called "fractal.vfs/lib", with inside it "fractal.vfs/lib/app-fractal/fractal.tcl" - that's the fractal app code.

Make some changes. Then run the (unwrapped!) result using:

    tclkit fractal.vfs/main.tcl

As you can see, main.tcl will execute the fractal app code. It does that by doing a "package require app-fractal" as last step. This works, because starkits are set up to find packages in their internal "lib" directory. There is no magic - these conventions just make starkits easy to use and extend: Tcl's $auto_path is adjusted by main.tcl when launched, this works in unwrapped as well as in wrapped mode.

Once you understand how main.tcl and fractal.tcl work together, you have all the machinery worked out to use them yourself. You can add other packages to the "lib" directory to include them. To create a new adjusted fractal.kit, wrap it by typing:

    tclkit sdx.kit wrap fractal.kit

SDX will take all of "fractal.vfs" and wrap it up, overwriting "fractal.kit". Now ship it!

tclkit index

Tclkit home page





Tclkit Lite