Search code examples
pythontkintertclpy2exefreeze

Understanding what files in the TCL are required for distributing frozen Python Tkinter apps


I'm trying to figure out which files in Python's (Python 2.6/Python 2.7) tcl folder are required in order to distribute frozen Python Tkinter apps using Py2exe or similar.

The quick and dirty way to do this (using pyexe as an example) is to follow the 2nd example on the following page and then xcopy your python's tcl folder to your dist folder (as a tcl sub-folder). http://www.py2exe.org/index.cgi/TixSetup

The problem with the xcopy tcl technique is that it copies 100's of extra files that may not be needed for distribution.

For example, my experiments show that the following tcl folders may(???) not be needed when freezing Python 2.7 Tkinter applications:

Note: The numeric sizes are the sum of all the files in each of these paths.

  • tcl\tcl8.5\encoding 1415K (delete non-applicable encodings? any needed for UTF-8/Unicode?)
  • tcl\tcl8.5\tzdata 1450K (timezone data for a tcl clock demo?)
  • tcl\tcl8.5*.tcl 256K
  • tcl\tix8.4.3\demos 246K
  • tcl\tk8.5\demos 685K

Am I on the right path or will not including the above tcl content bite me in the butt down the road?

Even better, is there some sort of documentation regarding the files in Python's tcl folder?


Solution

  • You don't need the demos (I hope; if you do, that's gross!) but everything else is potentially required; the encodings are used to convert between the outside world's bytes and Tcl's characters, and the tzdata is used to make the time processing work. You can trim the encodings and tzdata if you are delivering the app to a small target market – indeed, on Unix you might be able to leave out the whole of tzdata because the system will have an up-to-date version – but you should be aware that you are restricting the code's portability.