How remove Tcl/Tk fom py2exe distribution?

Michael Peuser mpeuser at
Sat Aug 16 09:42:25 CEST 2003

Hi Graham - thnak you for your answer!

"Graham Fawcett" <fawcett at> schrieb im Newsbeitrag
news:mailman.1061014105.16562.python-list at
> Michael Peuser wrote:
> >Hi,
> >I should like to make a distribution (using Tkinter), with standard DLLs
> >removed.
[..details in first posting ...]
> It's a bit unclear, Michael, what you're trying to accomplish. On the
> one hand, you're using py2exe to deploy your application, which suggests
> that you don't expect your users to have a Python distribution on their
> computers. On the other hand, you're looking to deploy a Tkinter app,
> but without any tcl/tk files, because they "belong to the standard
> distribution", suggesting that you *do* expect your users to have a
> Python distribution.

It is more difficult:
I *can* request the potiential user to install a "standard" Python of a
given version, but not more! And by no means do I want to interfere with his
or her installation. This means *everything* except  minimal Python
(includingTcl/Tk) must be packed somehow.....

The program shall not be *installed* but run from a double click!

Only on special request I can deliver thePython-, Tcl-, Tk- dlls and this
phantastic Tcl folder with megabytes of chinese character sets....

But I mostly want to reduce the size of the distribution, especially in
upgrade and bug-fix situations.

> In case I'm missing something: you could always, as part of your build,
> just delete files from the py2exe-generated build directory. For
> example, at the end of your script, add some lines to delete
> the tk/tcl files from your build path.  I've used this "strategy"
> sometimes when building py2exe apps that use the Python Imaging Library.
> (PIL has tcl/tk import dependencies, but doesn't actually need tcl/tk
> for the majority of its functions.)
> -- Graham

I tried this! This will not help, because - in this case - Tkinter *is*
used. The importer just does not find it (probably because py2exe modifies
its behaviour....

This is why I use

        Tkinter= __import__("Tkinter")

But this does not wort either...

Kindly Michael P

More information about the Python-list mailing list