wxPython - py2exe - exe文件旧窗口 [英] wxPython - py2exe - exe file old window
问题描述
我正在使用 py2exe 将使用 wxPython 制作的 GUI 应用程序转换为独立的单个 exe 文件.这是我在 setup.py 中使用的:
I'm using py2exe to convert my GUI application made using wxPython to a standalone single exe file. This is what i'm using in setup.py:
from distutils.core import setup
import py2exe
includes = []
excludes = ['_gtkagg', '_tkagg', 'bsddb', 'curses', 'email', 'pywin.debugger',
'pywin.debugger.dbgcon', 'pywin.dialogs', 'tcl',
'Tkconstants', 'Tkinter']
packages = []
dll_excludes = ['libgdk-win32-2.0-0.dll', 'libgobject-2.0-0.dll', 'tcl84.dll',
'tk84.dll']
setup(
options = {"py2exe": {"compressed": True,
"optimize": 2,
"includes": includes,
"excludes": excludes,
"packages": packages,
"dll_excludes": dll_excludes,
"bundle_files": 1,
"dist_dir": "dist",
"skip_archive": False,
"ascii": False,
"custom_boot_script": '',
}
},
zipfile = None,
windows=['script.py']
)
一切顺利,但我面临的问题是 UI 看起来很旧.就像Windows 97的界面什么的.这是图片:
Everything goes well, but the problem I'm facing is that the UI looks old. It's like the interface of Windows 97 or something. Here's the image:
推荐答案
我也遇到过这个问题,找到了解决方案.
为了让 windows 控件看起来正常,首先你必须将清单插入目标可执行文件,就像 此处 提及.
I have also encountered this problem and found a solution.
To let windows controls looks normal, first you MUST insert manifest to the target executable file, just as here mentions.
manifest = """
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1"
manifestVersion="1.0">
<assemblyIdentity
version="0.64.1.0"
processorArchitecture="x86"
name="Controls"
type="win32"
/>
<description>Your Application</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>
"""
setup(
windows = [
{
"script": "yourapplication.py",
"icon_resources": [(1, "yourapplication.ico")],
"other_resources": [(24,1,manifest)]
}
],
data_files=["yourapplication.ico"]
)
其次,您必须获得相应的运行时 dll.
要获取清单和dll,您可以下载Dropbox 并安装,然后进入已安装的文件夹,使用Manifest View 从 Dropbox.exe 获取清单和子文件夹 Microsoft.VC90.CRT 中的 dll(将此文件夹保留在您的应用程序目录中).以下是我从 Dropbox.exe 得到的.
Second, you MUST get the corresponding run-time dlls.
To get manifest and dlls, you could download Dropbox and install, and enter the installed folder, use Manifest View to get manifest from Dropbox.exe and dlls from sub-folder Microsoft.VC90.CRT (Keep this folder in your app dist). The following is what I have gotten from Dropbox.exe.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<asmv3:application xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<asmv3:windowsSettings
xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
<dpiAware>true</dpiAware>
</asmv3:windowsSettings>
</asmv3:application>
<assemblyIdentity
version="2.6.25.0"
processorArchitecture="X86"
name="Dropbox"
type="win32"
/>
<description>*</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.VC90.CRT"
version="9.0.30729.1"
processorArchitecture="x86"
publicKeyToken="1fc8b3b9a1e18e3b"
/>
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>
然后目标exe运行得很好.
Then the target exe runs very well.
这篇关于wxPython - py2exe - exe文件旧窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!