Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2296829
  • 博文数量: 321
  • 博客积分: 3440
  • 博客等级: 中校
  • 技术积分: 2992
  • 用 户 组: 普通用户
  • 注册时间: 2007-05-24 09:08
个人简介

我就在这里

文章分类

全部博文(321)

文章存档

2015年(9)

2014年(84)

2013年(101)

2012年(25)

2011年(29)

2010年(21)

2009年(6)

2008年(23)

2007年(23)

分类: Python/Ruby

2014-08-25 07:48:39

下载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中 添加

  1. <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
  2.      <security>
  3.      <requestedPrivileges>
  4.      <requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
  5.      </requestedPrivileges>
  6.      </security>
  7. </trustInfo>

下面是我的完整打包代码
注意修改版本号为
version="9.0.21022.8"

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

  15.     for p in win32com.__path__[1:]:
  16.         modulefinder.AddPackagePath("win32com", p)
  17.     for extra in ["win32com.shell"]: #,"win32com.mapi"
  18.         __import__(extra)
  19.         m = sys.modules[extra]
  20.         for p in m.__path__[1:]:
  21.             modulefinder.AddPackagePath(extra, p)
  22. except ImportError:
  23.     # no build path setup, no worries.
  24.     pass

  25. manifest = """


  26.     
  27.     
  28.     
  29.     
  30.     
  31.     
  32.     
  33.     VF5ECUAHPV7EnUf+/UIXMPizPvs=
  34.     
  35.     
  36.     
  37.     
  38.     
  39.     3Wg+StVMq2uhx7POnAkl2w4dDmY=
  40.     
  41.     
  42.     
  43.     
  44.     
  45.     
  46.     
  47.     /YfRn7UQENzdMeoMHxTgdRMiObA=
  48.     
  49.     ETimes SafeDocument
  50.     
  51.     
  52.     
  53.     
  54.         
  55.         
  56.     
  57.     
  58.     
  59.     
  60.     
  61.     

  62. """

  63. data_files = [("Microsoft.VC90.CRT",
  64.                glob(r'C:\Program Files\Microsoft Visual Studio 9.0\VC\redist\x86\Microsoft.VC90.CRT\*.*'))]
  65. py2exe_options = {"py2exe": {
  66.     "compressed": 1,
  67.     "optimize": 0,
  68.     "bundle_files": 1,
  69.     "dll_excludes": ["mswsock.dll", "powrprof.dll"],
  70.     "excludes": ["email", "System", "clr"],
  71.     "typelibs": [("{A435DD76-804E-4475-8FAB-986EACD1C6BE}", 0x0, 1, 0), ]
  72. }
  73. }
  74. setup(
  75.     data_files=data_files,
  76.     windows=[{
  77.         'script': 'EtimesDocument.pyw',
  78.         "other_resources":[(24,1,manifest)],
  79.         "icon_resources": [
  80.             (0, './png/Attach.ico')
  81.         ]}],
  82.     zipfile='core.lib
转自:http://blog.csdn.net/xugangjava/article/details/8049224


阅读(2681) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~