Introduction

[http://tix.sourceforge.net/ Tix], the Tk Interface eXtension, is a powerful set of user interface components that expands the capabilities of your Tcl/Tk and Python applications. This page describes building a "Hello World" Tix application with py2exe.

Tix Hello World

Here is a very simple Tix application. Save it as hello.py:

   1 import Tix
   2 
   3 window = Tix.Tk()
   4 Tix.Label(window, text='Hello World').grid()
   5 window.mainloop()

setup.py for hello.py

py2exe doesn't discover the use of the Tix DLL and Tcl files, so you must include them explicitly. The following setup.py builds a working EXE for the hello.py above:

   1 import glob
   2 import os
   3 import sys
   4 from distutils.core import setup
   5 import py2exe
   6 
   7 def files(folder):
   8     for path in glob.glob(folder+'/*'):
   9         if os.path.isfile(path):
  10             yield path
  11 
  12 data_files=[
  13             ('.', glob.glob(sys.prefix+'/DLLs/tix81*.dll')),
  14             ('tcl/tix8.1', files(sys.prefix+'/tcl/tix8.1')),
  15             ('tcl/tix8.1/bitmaps', files(sys.prefix+'/tcl/tix8.1/bitmaps')),
  16             ('tcl/tix8.1/pref', files(sys.prefix+'/tcl/tix8.1/pref')),
  17            ]
  18 
  19 setup(
  20       script_args=['py2exe'],
  21       windows=['hello.py'],
  22       data_files=data_files,
  23      )