List Info

Thread: py2exe and winxptheme




py2exe and winxptheme
user name
2006-11-14 15:28:10
Hi all,

    I am having some troubles mixing py2exe and winxptheme.
Basically,
I am using wxPython 2.7.2.0 with Python 2.5, and painting
some window
background using the UxTheme via winxptheme. This is what I
am doing:

hwnd = MyWindow.GetHandle()
self.hTheme = winxptheme.OpenThemeData(hwnd,
"Window")

winxptheme.DrawThemeBackground(self.hTheme, dc.GetHDC(), 5,
1,
                               (rc.top, rc.left, rc.right,
rc.bottom), None)


This works very well using python directly, but when I
generate and
executable file with py2exe, I get this error when executing
that last
line:

TypeError: an integer is required

This is because self.hTheme is *None*. It seems like
OpenThemeData can
not be initialized in an executable, or at least that I am
not able to
do it.
Does anyone have a possible solution to this problem? I have
tried all
the possibilities with py2exe, meaning bundle=1, bundle=2,
bundle=3,
compressed=1, compressed=2, every possible combination. But
it doesn't
work :-(

I attach my setup file, if it can be of any help.

Thank you very much for every pointer.

Andrea.

"Imagination Is The Only Weapon In The War Against
Reality."
http://xoomer.v
irgilio.it/infinity77/
from distutils.core import setup
import py2exe
import glob
import os
import matplotlib
import shutil


shutil.rmtree("build", ignore_errors=True)
mplfiles =
glob.glob(os.sep.join([matplotlib.get_data_path(), '*']))

# Need to explicitly remove cocoa_agg nib folder or py2exe
complains
mplfiles.remove(os.sep.join([matplotlib.get_data_path(),
'Matplotlib.nib']))

lst = os.listdir(os.getcwd())

incl = []
for files in lst:
    if files.endswith(".py") or
files.endswith(".PY"):
        incl.append(files[:-3])

includes = incl
packages = ['matplotlib.numerix','pytz']
excludes = ["Tkconstants", "Tkinter",
"tcl", '_gtkagg', '_tkagg']

excludes.extend(['_gtkagg','_tkagg','Tkconstants','pywin.deb
ugger',
                 'pywin.debugger.dbgcon','pywin.dialogs',
'bsddb',
                
'curses','email','distutil','logging','readline',
                 'setuptools'])

dll_excludes = ['libgdk-win32-2.0-0.dll',
'libgobject-2.0-0.dll',
                'tcl84.dll', 'tk84.dll', 'gdiplus.dll']

setup(

    version = "0.1",
    description = "KPObject",
    name = "KPObject",

    data_files = [('matplotlibdata', mplfiles)],

    options = {"py2exe": {"compressed":
1, 
                          "optimize": 2,
                          "includes": includes,
                          "excludes": excludes,
                          "packages": packages,
                          "dll_excludes":
dll_excludes,
                          "bundle_files": 1,
                          }},

    zipfile = None,
    windows = [{"script":
"KPObject.py",
                "icon_resources": [(1,
"icons/eni.ico")]}]

    )

_______________________________________________
Python-win32 mailing list
Python-win32python.org

http://mail.python.org/mailman/listinfo/python-win32
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )