gpt4 book ai didi

python - wxPython - py2exe - exe 文件旧窗口

转载 作者:行者123 更新时间:2023-12-01 05:44:23 24 4
gpt4 key购买 nike

我正在使用 py2exe 将使用 wxPython 制作的 GUI 应用程序转换为独立的单个 exe 文件。这是我在 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']
)

一切都很顺利,但我面临的问题是用户界面看起来很旧。就像Windows 97的界面什么的。这是图片:

screenshot

最佳答案

我也遇到过这个问题,并找到了解决办法。
为了让Windows控件看起来正常,首先必须将 list 插入到目标可执行文件中,就像here提及。

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。
要获取 list 和 dll,您可以下载 Dropbox并安装,并进入安装的文件夹,使用Manifest View从 Dropbox.exe 获取 list 并从子文件夹 Microsoft.VC90.CRT 获取 dll(将此文件夹保留在您的应用程序 dist 中)。以下是我从 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运行得很好。

关于python - wxPython - py2exe - exe 文件旧窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16605312/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com