Version 0 of A Simple Multi-File Starkit Example

Updated 2007-09-07 22:58:24 by JC

A simple single file hello.tcl Starkit under the title Build Your First Starkit. This tutorial takes you beyond a simple single file hello.tcl Starkit into a mult-file hello.tcl Starkit. The code presented here was developed quickly after chatting in the Tkchat application.

First, this example is going to show how to start without using the qwrap method. It's quite easy. Create the following directory structure:

 Hello.vfs/
 Hello.vfs/lib/

Hello.vfs is where our code will go and Hello.vfs/lib is where any extensions may be placed.

Create the main.tcl file under the Hello.vfs directory:

 # Get the current scripts directory

 set dir [file dirname [info script]]; 

 # Source in the supporting file with the current scripts 
 # directory as it's base

 source [file join $dir funcs.tcl]

 # The example code

 button .hello -text "Say Hello" -command { sayHello "World" }
 pack .hello -padx 5 -pady 5 -expand 1 -fill both

Create the "sourced" file, funcs.tcl also in the Hello.vfs directory:

 # Supporting functions

 proc sayHello {toWho} {
         tk_messageBox -icon info -type ok -title "Saying Hello" -message "Hello, $toWho"
 }

Now you can wrap it with the sdx command:

 sdx wrap Hello.kit

and run your new multi-file Starkit:

 tclkit Hello.kit

This page was created by a novice, so your milage may vary. Please, comment on this if you have further instructions or better ways of doing it.