How to make .exe for Python with good graphics?

I have a Python application and I decided to make .exe to execute it.

This is the code I use to use .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 .exe, the graphics are completely different.

In the following figure, you can see the application on which mental python is running on the left and running it .exe on the right. alt text

How can I make .exe as good as the one that runs mental python?

+3
source share
3 answers

, . EXE , Windows comctl32.dll.

Windows XP Windows Forms MSDN. .exe.manifest.

py2exe wxPython. , setup.py .

+7

, , :

# -*- 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"],
)

:)

+1

, , Python 2.6 Windows 7. , Python 2.5 XP Vista. GUI2Exe, , , , .

. :

http://www.blog.pythonlibrary.org/2010/07/31/a-py2exe-tutorial-build-a-binary-series/

http://www.blog.pythonlibrary.org/2010/08/31/another-gui2exe-tutorial-build-a-binary-series/

In addition, there is also a Python-related manifest for something 2.6+ due to switching in compilers on Windows (i.e. VS2008 vs. old VS2003). Robin Dunn seems to have fixed the latest version of wxPython, so you don't need to include this annoyance, but if you are NOT using wx, then you will probably encounter this problem when trying to create a binary. The py2exe and wxPython wiki sites talk about this issue and how to create an SxS manifest.

0
source

Source: https://habr.com/ru/post/1765893/


All Articles