I have a Python application and I decided to do a .exe to execute it.
This is the code that I use to do the .exe:
# -*- coding: cp1252 -*-
from distutils.core import setup
import py2exe, sys, os
sys.argv.append('py2exe')
setup(
options = {'py2exe': {'bundle_files': 1}},
windows = [{'script': "SoundLog.py"}],
zipfile = None,
packages=[r"C:\Users\Public\SoundLog\Code\Código Python\SoundLog\Auxiliar", r"C:\Users\Public\SoundLog\Code\Código Python\SoundLog\Plugins"],
)
But when I run my application with the .exe, the graphics are quite different.
In the image bellow you can see the application running thought python at the left and running thought the .exe at the right.

How can I make the .exe one be as good as the one that runs thought python?
I assume you mean the visual style of the toolbar and buttons. You need to add a manifest file to the EXE file or as a separate file so that Windows applies the modern style of recent comctl32.dll versions.
Check out Using Windows XP Visual Styles With Controls on Windows Forms on MSDN. Read the relevant part about creating the ".exe.manifest" file.
A more py2exe-specific tutorial can be found over at the wxPython site. They explain how to use setup.py to include the necessary manifest file.
The final setup that I mounted was this:
# -*- coding: cp1252 -*-
from distutils.core import setup
import py2exe, sys, os
from glob import glob
sys.argv.append('py2exe')
manifest = """
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level='asInvoker' uiAccess='false' />
</requestedPrivileges>
</security>
</trustInfo>
<dependency>
<dependentAssembly>
<assemblyIdentity
type='win32'
name='Microsoft.VC90.CRT'
version='9.0.21022.8'
processorArchitecture='*'
publicKeyToken='1fc8b3b9a1e18e3b' />
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*" />
</dependentAssembly>
</dependency>
</assembly>
"""
setup(
## data_files = data_files,
options = {'py2exe': {'bundle_files': 1}},
windows = [{'script': "SoundLog.py", 'other_resources': [(24,1,manifest)]}],
zipfile = None,
packages=[r"C:\Users\Public\SoundLog\Code\Código Python\SoundLog\Auxiliar", r"C:\Users\Public\SoundLog\Code\Código Python\SoundLog\Plugins"],
)
Thanks for the quick answers :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With