Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Packaging Tcl/Tk Application on Windows: Single File Executable

156 views
Skip to first unread message

Andy

unread,
Nov 29, 2005, 4:17:09 AM11/29/05
to
Hi all,

I need to package application developed in Tcl/Tk on Windows. It should
be a single file executable with all data files (gifs), dependency
packages such as winico bundled into a single executable.

There should be not reference to external data files such as images ..
All should be bundled as a single file on desktop.

I have used mktclapp and also freewrap but one needs to keep the image
files separate.

Do I have to change code to include the image files data ?

Thanks in advance,
Andy

sleb...@gmail.com

unread,
Nov 29, 2005, 4:51:09 AM11/29/05
to
Andy wrote:
> Hi all,
>
> I need to package application developed in Tcl/Tk on Windows. It should
> be a single file executable with all data files (gifs), dependency
> packages such as winico bundled into a single executable.
>
> There should be not reference to external data files such as images ..
> All should be bundled as a single file on desktop.
>
> I have used mktclapp and also freewrap but one needs to keep the image
> files separate.
>

Freewrap can include image file. Either simply:

freewrap my_main.tcl some_image.gif some_image.jpg

or include a list of images & dependency packages in a file and use the
-f option:

freewrap another_of_my_main.tcl -f includes.txt

A quick way to generate the includes file is:

dir /s /b c:\path\to\my\images\ > includes.txt

then simply edit the generated file to remove unused images. This can
also be done for including packages. For example, to include tcllib:

dir /s /b c:\tcl\lib\tcllib1.7\ > tcllib_includes.txt

This works with all pure tcl packages including bwidget and tcllib.
Packages with dlls can't be included this way. But your winico package
is already compiled into freewrap so you don't have to include it.

> Do I have to change code to include the image files data ?
>

with freewrap you don't have to. It automagically looks for the wrapped
images if it can't find it on disk.

Andy

unread,
Nov 29, 2005, 6:03:17 AM11/29/05
to
Hi,

I tried the steps you gave. But when I run the exe, I get the console
window. It doesnot show the UI of my application.

Here are few clarifications sought

1) I am looking at exe which has bundled the image files and which
shall not on the disk. Hope freewrap takes care of that
2) Do i need to package any tcl/tk dlls/libs or freewrap takes care of
that ..
3) the filelist file generated for the images has absolute path for
each image name. Is this causing problem to run the app ?

Please revert as i cannot get the executable to run

Thx
Andy

sleb...@gmail.com

unread,
Nov 29, 2005, 6:15:50 AM11/29/05
to
Andy wrote:
> Hi,
>
> I tried the steps you gave. But when I run the exe, I get the console
> window. It doesnot show the UI of my application.
>

Ah, probably a bug. Get an older or newer version of freewrap and see
if it works. Also, make sure you download freewrap and not
freewrapTCLSH. The TCLSH version does not include Tk and is meant only
for command line apps.
Some version of freewrap automatically hides the console, some version
of freewrap shows console. So it is best to do:

console hide

at the beginning of your code just to be safe.

> Here are few clarifications sought
>
> 1) I am looking at exe which has bundled the image files and which
> shall not on the disk. Hope freewrap takes care of that

freewrap takes care of that

> 2) Do i need to package any tcl/tk dlls/libs or freewrap takes care of
> that ..

you can't wrap dlls. But you can load dlls from disk. Libs which don't
use dlls (pure tcl) can be wrapped. See
http://freewrap.sourceforge.net/freewrap_howto.html

> 3) the filelist file generated for the images has absolute path for
> each image name. Is this causing problem to run the app ?
>

this is OK. The app will run perfectly with no modifications. Freewrap
will simulate the absolute path of your images internally. The only
issue is if you want to develop the code on two different machines.
Since the path is absolute, both machines must have files at the same
absolute locations. But this only applies to developers, freewrap will
take care of it for your end users.

Note that freewrap uses a fallback mechanism where if it can't find
something internally it will search the disk. This means to really test
your app you should run it on a machine without tcl installed.
Otherwise you may forget to include a lib/file and not notice it until
your client runs the app...

Gerald W. Lester

unread,
Nov 29, 2005, 8:11:43 AM11/29/05
to

You may want to try Startpacks. See http://wiki.tcl.tk/starpack

Roy Terry

unread,
Nov 29, 2005, 11:08:51 AM11/29/05
to
"Andy" <kale...@gmail.com> wrote in message
news:1133259597.9...@f14g2000cwb.googlegroups.com...

> Hi,
>
> I tried the steps you gave. But when I run the exe, I get the console
> window. It doesnot show the UI of my application.
In the console window type
puts $errorInfo

Copy all the contents of the console
window and post it back to this thread.
That should reveal the (1st) problem.

In the mean time you might also
consider:
1. Are you telling freewrap explictly to load
your image files?
2. When you refer to wrapped files
you will need absolute paths - but *not*
drive letters.
So if you're using a file
c:/projects/prog1/star.jpeg
then refer to it as
/projects/prog1/star.jpeg

3. Also, files are found by searching a
zip archive and I believe that search is
case sensitive (was in the past) you can
simply use a zip utility to
look at the file names in the archive
and see if the case of the archive
matches the case you're using in
code to reference the files.

4. re images, do you require the
Img extension? Native Tcl/Tk only
supports the GIF and PPM/PGM
image types. If you are using Img you
will need to wrap up its whole directory,
unwrap it onto the local disk and then
lappend the unwrap directory to auto_path.

This doesn't take much code at all. See the
freewrap page
http://freewrap.sourceforge.net/freewrap_howto.html#5

HTH,
Roy

Note to Dennis laBelle:
A freewrap feature to wrap and
unwrap Img in a couple of procs
would be a super enhancement for freewrap.

Dennis LaBelle

unread,
Nov 29, 2005, 6:34:54 PM11/29/05
to
Roy Terry wrote:

I think it would just be easier for me to compile the Img extension right
into freeWrap itself. Would that be "super", too?

Dennis

Roy Terry

unread,
Nov 29, 2005, 6:42:34 PM11/29/05
to

"Dennis LaBelle" <labe...@nycap.rr.com> wrote in message
news:yA5jf.40751$DL6....@twister.nyroc.rr.com...

> Roy Terry wrote:
>
> > Note to Dennis laBelle:
> > A freewrap feature to wrap and
> > unwrap Img in a couple of procs
> > would be a super enhancement for freewrap.
>
> I think it would just be easier for me to compile the Img extension right
> into freeWrap itself. Would that be "super", too?
I thought of compiling in too but Img uses a
lot of .dll files for the various formats so I wonder
if static link might be impractical or
even impossible.
>
> Dennis
>


Dennis LaBelle

unread,
Nov 29, 2005, 6:45:12 PM11/29/05
to
Roy Terry wrote:

I don't expect it to be too much of a problem. It should just make the
freeWrap program a little bigger.

Dennis

Dennis LaBelle

unread,
Nov 29, 2005, 6:47:41 PM11/29/05
to
Andy wrote:

> Hi,
>
> I tried the steps you gave. But when I run the exe, I get the console
> window. It doesnot show the UI of my application.

Version 5.6x of freeWrap had this auto-display of the console bug. If you
are using one of the 5.6x versions you can either get a newer one or use
the [console hide] command to hide it.

sleb...@gmail.com

unread,
Nov 29, 2005, 9:25:38 PM11/29/05
to

Oh yes that would be super ;-)
But make it a different flavour like you did with BLT and TCLSH
versions. Freewrap keeps getting larger as it is. I keep having to use
older versions of freewrap sometimes to make my apps fit on a 1.44M
floppy (some of us still distribute on floppies :-P )

Also, what happened to the encryption/obfuscation function. I just
realised newer versions of freewrap no longer obfuscate my scripts.

I would also like to take this opportunity thank you for freewrap. I
was once stuck with a problem at a site. The laptop I had didn't have
any debugging tool nor did it have any development tool installed. Then
I remembered that one of our in-house apps is freewrapped. I wrote a
simple serial line monitoring script in tcl, opened up the app in
winzip, replaced the main script with my new script, edited some bits
in there to make the freewrapped app recognise my new script and saved
it back to disk. Then I changed the extension back to .exe and
double-clicked on the app. It worked! I was able to develop new
software, on site, in 3 hours without a development environment. My
boss was impressed and relieved that they didn't have to ship another
laptop to the site just to debug the problem.

Andy

unread,
Nov 29, 2005, 11:43:01 PM11/29/05
to
Thx All,

Yes i have to give relative path for the files sourced and image data
files and managed to make the executable

Andy

0 new messages