Home > Database > Mysql Tutorial > Py2exe 打包后图标不显示

Py2exe 打包后图标不显示

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 15:26:19
Original
915 people have browsed it

下载Png2Ico http://www.winterdrache.de/freeware/png2ico/ 编辑图标大小准备 248*248 128*128 64*64 48*48 32*32 16*16的图标 命令下执行 Png2Icon.exe Attach.ico logo248.png logo128.png,logo64.png logo48.png logo32.png logo16.png 生成Ico文件 这样

下载Png2Ico 

http://www.winterdrache.de/freeware/png2ico/

编辑图标大小准备 248*248 128*128 64*64 48*48 32*32 16*16的图标

命令下执行 Png2Icon.exe Attach.ico logo248.png logo128.png,logo64.png logo48.png logo32.png logo16.png 

生成Ico文件 这样就能适应win7下面的大小了。

如果程序需要管理员身份运行,在mainfest中 添加

 <trustinfo xmlns="urn:schemas-microsoft-com:asm.v3">
	    <security>
	      <requestedprivileges>
	        <requestedexecutionlevel level="requireAdministrator" uiaccess="false"></requestedexecutionlevel>
	      </requestedprivileges>
	    </security>
</trustinfo>
Copy after login

下面是我的完整打包代码

注意修改版本号为version="9.0.21022.8"

# -*- coding:gbk -*-
from distutils.core import  setup
from glob import glob
try:
	# py2exe 0.6.4 introduced a replacement modulefinder.
	# This means we have to add package paths there, not to the built-in
	# one.  If this new modulefinder gets integrated into Python, then
	# we might be able to revert this some day.
	# if this doesn't work, try import modulefinder
	try:
		import py2exe.mf as modulefinder
	except ImportError:
		import modulefinder
	import win32com, sys

	for p in win32com.__path__[1:]:
		modulefinder.AddPackagePath("win32com", p)
	for extra in ["win32com.shell"]: #,"win32com.mapi"
		__import__(extra)
		m = sys.modules[extra]
		for p in m.__path__[1:]:
			modulefinder.AddPackagePath(extra, p)
except ImportError:
	# no build path setup, no worries.
	pass

manifest = """
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestversion="1.0">
    <noinheritable></noinheritable>
    <assemblyidentity type="win32" name="Microsoft.VC90.CRT" version="9.0.21022.8" processorarchitecture="x86" publickeytoken="1fc8b3b9a1e18e3b">
	</assemblyidentity>
    <file name="msvcr90.dll" hashalg="SHA1" hash="9785b1c493deb5b2134dc4aef3719cee207001bc">
	<hash xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">
	<transforms><transform algorithm="urn:schemas-microsoft-com:HashTransforms.Identity">
	</transform></transforms><digestmethod algorithm="http://www.w3.org/2000/09/xmldsig#sha1">
	</digestmethod><digestvalue>VF5ECUAHPV7EnUf+/UIXMPizPvs=</digestvalue></hash>
	</file>
	<file name="msvcp90.dll" hashalg="SHA1" hash="0f6bbf7fe4fb3fca2cb5b542eca1a1cad051f01c">
	<hash xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">
	<transforms><transform algorithm="urn:schemas-microsoft-com:HashTransforms.Identity"></transform>
	</transforms><digestmethod algorithm="http://www.w3.org/2000/09/xmldsig#sha1">
	</digestmethod><digestvalue>3Wg+StVMq2uhx7POnAkl2w4dDmY=</digestvalue></hash>
	</file>
	<file name="msvcm90.dll" hashalg="SHA1" hash="7f3290ab2b7444c2b4a9b1fedfdb16466d7a21bb">
	<hash xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">
	<transforms><transform algorithm="urn:schemas-microsoft-com:HashTransforms.Identity">
	</transform>
	</transforms>
	<digestmethod algorithm="http://www.w3.org/2000/09/xmldsig#sha1">
	</digestmethod><digestvalue>/YfRn7UQENzdMeoMHxTgdRMiObA=</digestvalue></hash>
	</file>
	<description>ETimes SafeDocument </description>
	<dependency>
	    <dependentassembly>
	      <assemblyidentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorarchitecture="x86" publickeytoken="6595b64144ccf1df" language="*"></assemblyidentity>
	    </dependentassembly>
        </dependency>
        <trustinfo xmlns="urn:schemas-microsoft-com:asm.v3">
	    <security>
	      <requestedprivileges>
	        <requestedexecutionlevel level="requireAdministrator" uiaccess="false"></requestedexecutionlevel>
	      </requestedprivileges>
	    </security>
	</trustinfo>
</assembly>
"""

data_files = [("Microsoft.VC90.CRT",
               glob(r'C:\Program Files\Microsoft Visual Studio 9.0\VC\redist\x86\Microsoft.VC90.CRT\*.*'))]
py2exe_options = {"py2exe": {
	"compressed": 1,
	"optimize": 0,
	"bundle_files": 1,
	"dll_excludes": ["mswsock.dll", "powrprof.dll"],
	"excludes": ["email", "System", "clr"],
	"typelibs": [("{A435DD76-804E-4475-8FAB-986EACD1C6BE}", 0x0, 1, 0), ]
}
}
setup(
	data_files=data_files,
	windows=[{
		'script': 'EtimesDocument.pyw',
		"other_resources":[(24,1,manifest)],
		"icon_resources": [
			(0, './png/Attach.ico')
		]}],
	zipfile='core.lib',
	options=py2exe_options
)
Copy after login


Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template