wxPython and Py2Exe... 2 questions

Durumdara durumdara at gmail.com
Mon Feb 27 07:21:08 EST 2006


Hi !

I have an application that I compile to exe.

1.)
I want to compile main.ico into exe, or int zip. Can I do it ?

2.)
Can I compile the result to my specified directory, not into the dist ?
I want to structure my projects like this:
\src\
python codes, etc.
\res\
icons, etc
\bin\
the compiled version (exe, bins)
Can I do it with py2exe ?

Thanx for the help:
dd

Ps:
The setup file is:
# A setup script showing advanced features.
#
# Note that for the NT service to build correctly, you need at least
# win32all build 161, for the COM samples, you need build 163.
# Requires wxPython, and Tim Golden's WMI module.

# Note: WMI is probably NOT a good example for demonstrating how to
# include a pywin32 typelib wrapper into the exe: wmi uses different
# typelib versions on win2k and winXP.  The resulting exe will only
# run on the same windows version as the one used to build the exe.
# So, the newest version of wmi.py doesn't use any typelib anymore.

from distutils.core import setup
import py2exe
import sys

# If run without args, build executables, in quiet mode.
if len(sys.argv) == 1:
    sys.argv.append("py2exe")
    sys.argv.append("-q")

class Target:
    def __init__(self, **kw):
        self.__dict__.update(kw)
        # for the versioninfo resources
        self.version = "1.5.0"
        self.company_name = "DurumDara Ltd."
        self.copyright = "Copyright by DurumDara 2006."
        self.name = "wxPyHDDirList"

################################################################
# A program using wxPython

# The manifest will be inserted as resource into test_wx.exe.  This
# gives the controls the Windows XP appearance (if run on XP ;-)
#
# Another option would be to store it in a file named
# test_wx.exe.manifest, and copy it with the data_files option into
# the dist-dir.
#

wxPyHDDirList = Target(
    # used for the versioninfo resource
    description = "wxPyHDDirList",

    # what to build
    script = "wxPyHDDirList.py",
    icon_resources = [(1, "main.ico")],
    dest_base = "wxPyHDDirList")

setup(
    options = {"py2exe": {"bundle_files": 1,
                          "compressed": 1,
                          "optimize": 2}},
    # The lib directory contains everything except the executables and 
the python dll.
    # Can include a subdirectory name.
    windows = [wxPyHDDirList],
    )

Ps2:
A BUG !

setup(
    options = {"py2exe": {"bundle_files": 1,
                          "compressed": 3, # !
                          "optimize": 4}}, # !
    # The lib directory contains everything except the executables and 
the python dll.
    # Can include a subdirectory name.
    windows = [wxPyHDDirList],
    )

These valus makes that compiled exe is cannot do encodings (example: 
iso-8859-2).... :-(










More information about the Python-list mailing list