Correctly using source and exec in TclApp

Posted by jeff.griffiths on 2006-09-05 11:10
OS: All / Any | Product: Tcl Dev Kit | tags: tclapp tcltk

When I wrap my Tcl application with TclApp, I get errors when my code tries to source or exec another wrapped tcl file.


This is usually a problem with relative paths within TclApp's vfs. Here is an example for how to work around this:

package require Tk

set ::DIR [file dirname [info script]]

button .b -text 'Kill!' -command {source $::DIR/sourced.tcl }

pack .b

This script is setting $::DIR to be the basepath of the current
script. You can use this value to source or exec other scripts either when
wrapped or running as a script, regardless of what CWD is.

enriquecorrea | Tue, 2009-08-25 16:02


i am testing TDK to create an executable tcl application.
I try it, but when i execute the executable, the application main window is not what i have programmed. It is only a grey window without buttons... simply nothing!

In the "Basic" Tab i have selected "base-tk8.5-thread-win32-ix86.exe" as prefix file (no more settings in this tab)
In the "Files" Tab i have selected all the application files and the main file was set too.
No settings in the tabs "Packages" and "Advanced"

By click on "Wrap" in the "Run" tab will be generated the exe file...

As commented, when i execute the exe file, the application main window is only a grey window without buttons nor all the components, that i have programmed...

Can anybody help me?

Thanks and best regards

enriquecorrea | Tue, 2009-08-25 16:07


im trying to use a custom icon in Tcl Dev Kit, but it does not work...
I have construct an icon 32*32 pixel with 32-bit color settings.
As prefix file i have selected "base-tk8.5-thread-win32-ix86.exe".

How can i create a valid icon or what kind of icons will be supported by this prefix file?

Thanks and best regards

gribpl | Wed, 2009-09-23 00:41

I've got the same problem. My custom icon is containing the same images resolutions and depths like the basekit. The tooltip even shows:
48x48: 32 bpp - ok
48x48: 32 bpp - ok
48x48: 32 bpp - ok
Wrapping ends with the message:
Inserting custom -icon D:/Downloads/etcl2.ico
[__] 32x32/8bpp: ignored, missing in prefix
[__] 16x16/8bpp: ignored, missing in prefix
[__] 48x48/32bpp: not replaced, missing in custom icon
[__] 32x32/32bpp: not replaced, missing in custom icon
[__] 16x16/32bpp: not replaced, missing in custom icon
The chosen custom icon caused no replacements

Even extracting the icon from the basekit and using it as custom icon ends without success.
Could anyone provide a sample or a solution?

basekit: base-tk8.5-thread-win32-ix86.exe.
TclApp Version: 5 Build 290359

jackr | Wed, 2009-09-23 15:06

Simlar issue.

The tool tip claims base-tk.5-thread-win32-ix86.exe contains 3 icons:

The icon embedded in prefix file.
variants found:

48x48: 32 bpp
32x32: 32 bpp
16x16: 32 bpp

The tool tip claims the custom icon file contains 3 icons:

Status of contents, compared to the icon in the prefix

48x48: 32 bpp - Ok
32x32: 32 bpp - Ok
16x16: 32 bpp - Ok

Issues reported during wrap:

[__] 48x48/32bpp: ignored, missing in prefix
[__] 32x32/32bpp: ignored, missing in prefix
[__] 16x16/32bpp: ignored, missing in prefix
[__] 48x48/32bpp: not replaced, missing in custom icon
[__] 32x32/32bpp: not replaced, missing in custom icon
[__] 16x16/32bpp: not replaced, missing in custom icon
The chosen custom icon caused no replacements

This appears that there is some issue with TclApp during wrap that may be out-of-sync with the tool tip analysis. How is it that both the prefix files and the icon file do not contain the 3 icons during wrap?

enriquecorrea | Tue, 2009-08-25 16:29


in the TDK documentation can be readed:

"TclApp is a tool that collects all of the files needed to run a Tcl application--such as Tcl scripts, graphics and other data files, Tcl extensions, a Tcl interpreter, and the standard Tcl and Tk libraries--into a single executable file. A user can then install this file anywhere on their system and execute it without installing any other packages or otherwise configuring their system"

I have created an executable with TDK and if i execute it, it does not work without the original tcl files...

My question is: If i want, for example, to use my application on another computer, do i need only the executable file or all the files have to be installed?
In case of i have to distribute all the original tcl files, how can i protect my code?

Thanks and best regards

th-wunderlich | Fri, 2011-07-15 05:28

Hello all,

as ActiveState changes the size and count of the needed icons in their prefix files
nearely every time, I recomment You to try IcoFx from
In the options (or preferences?) uncheck the compression for vista compatibility,
AFAIK the icon lib used in the wrapper TclApp don't know about the PNG saved icons.

On the very old TclPro there exist a variable tcl_platform(isWrapped). With this you
can distinct from wrapped or not and can set the right path names. Look for this in
the actual documentation and you will find the source that should be used for todays
ActiveState TCL/TK.

Hope that helps, Thomas