From: keithv on
Hi,

I'm writing an app that in some invocations needs to be
a GUI program with Tk, and at other times it wants to be
a command line program with output to the screen (batch
mode).

With straight Tcl this is easy--just run the script with
tclsh.exe and make "package require Tk" conditional.

Can the same be done with a starkit? I'm finding that
it always load Tk and loses stdout. I'm using runtime
tclkit-win32.upx.exe--is there a different one that doesn't
automatically load Tk (but potentially lets you load it
later).

Thanks,
Keith


From: Robert Heller on
At Thu, 1 Apr 2010 09:09:12 -0700 (PDT) keithv <kvetter(a)gmail.com> wrote:

>
> Hi,
>
> I'm writing an app that in some invocations needs to be
> a GUI program with Tk, and at other times it wants to be
> a command line program with output to the screen (batch
> mode).
>
> With straight Tcl this is easy--just run the script with
> tclsh.exe and make "package require Tk" conditional.
>
> Can the same be done with a starkit? I'm finding that
> it always load Tk and loses stdout. I'm using runtime
> tclkit-win32.upx.exe--is there a different one that doesn't
> automatically load Tk (but potentially lets you load it
> later).

Non-trivial for MS-Windows -- you'd have to build a custom tclkit.
There are two tclkit's for MS-Windows: the 'normal' one, with Tk (and
it always fires up Tk) and one without Tk (and Tk can't be fired up at
all [I Think]). The *UNIX* (including MacOSX) tclkit behave as you
would expect: unless you explicitly do a "package require Tk", you get
no GUI -- it is strickly a CLI kit.

>
> Thanks,
> Keith
>
>
>

--
Robert Heller -- 978-544-6933
Deepwoods Software -- Download the Model Railroad System
http://www.deepsoft.com/ -- Binaries for Linux and MS-Windows
heller(a)deepsoft.com -- http://www.deepsoft.com/ModelRailroadSystem/

From: Andreas Kupries on
keithv <kvetter(a)gmail.com> writes:

> Hi,
>
> I'm writing an app that in some invocations needs to be
> a GUI program with Tk, and at other times it wants to be
> a command line program with output to the screen (batch
> mode).
>
> With straight Tcl this is easy--just run the script with
> tclsh.exe and make "package require Tk" conditional.
>
> Can the same be done with a starkit? I'm finding that
> it always load Tk and loses stdout. I'm using runtime
> tclkit-win32.upx.exe--is there a different one that doesn't
> automatically load Tk (but potentially lets you load it
> later).

Yes. It is called tclkitsh AFAIK. Or, if you are using ActiveState's
basekits:

tclkit <=> base-tk
tclkitsh <=> base-tcl

--
So long,
Andreas Kupries <akupries(a)shaw.ca>
<http://www.purl.org/NET/akupries/>
Developer @ <http://www.activestate.com/>
-------------------------------------------------------------------------------