An important feature of the newer Tcl/Tk based applications is the ability to write extensions to directly add new functionality. These are typical add new commands onto the main menus.
The best method of explaining the process of creating an extension is to work through an example. Here we supply the full code for a Gap4 extension to count base composition. The same techniques will apply to writing extensions for other programs and we will point out the Gap4 specific components. The example is somewhat simplistic, but hopefully will explain the framework needed to write a more complex package.
The complete sources for the composition package can be found in the `src/composition' file.