[pygtk] Help: Problem with pygtk + py2exe

Cedric Gustin cedric.gustin at swing.be
Mon Aug 2 16:07:22 WST 2004


Jon Doda wrote:

> I'm trying to use py2exe on a small program written with pygtk.  The
> program was developed on a Slackware system using python 2.3.4, pygtk
> 2.2.0, gtk+ 2.4.4 and glade 2.6.0.  It runs fine on windows when python,
> gtk+ and pygtk are installed, but py2exe doesn't work.  When I run
> "setup.py py2exe" py2exe does its thing, but the last message it prints
> to the console is:
> 
> The following modules appear to be missing
> ['gdk', 'ltihooks']

Here is a working setup.py file for pygtk-demo.py

---- Cut here ----

# setup.py
from distutils.core import setup
import py2exe
import glob

opts = {
     "py2exe": {
         "includes": "pango,atk,gobject",
         "dll_excludes": ["iconv.dll","intl.dll","libatk-1.0-0.dll", 
                     		"libgdk_pixbuf-2.0-0.dll","libgdk-win32-2.0-0.dll",
                 "libglib-2.0-0.dll","libgmodule-2.0-0.dll",
                 "libgobject-2.0-0.dll","libgthread-2.0-0.dll",
                 "libgtk-win32-2.0-0.dll","libpango-1.0-0.dll",
                 "libpangowin32-1.0-0.dll"],
     }
}

setup(
	console=["pygtk-demo.py"],
	options=opts,
       	data_files=[("demos",
                    glob.glob("demos\\*.py")),"gtk-logo-rgb.gif"],)

---- Cut here ----

You should also comment out the "pygtk.require('2.0')" as it is not 
compatible with a py2exe'd application.

All the necessary files will be in the dist subdir but you still have to 
install a GTK+ runtime though...

Works with pygtk-2.2.0 and pygtk-2.3.95 + the GTK+ runtimes from 
dropline (2.2) and gladewin32 (2.4).

Hope it helps.

Cedric


More information about the pygtk mailing list