py2exe setup.py 带有图标
编译Python程序时如何为我的exe文件制作图标?
How do I make icons for my exe file when compiling my Python program?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
编译Python程序时如何为我的exe文件制作图标?
How do I make icons for my exe file when compiling my Python program?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(4)
我不久前正在搜索这个,发现了这个: http ://www.mail-archive.com/[email protected]/msg05619.html
引用上述链接:
I was searching for this a while ago, and found this: http://www.mail-archive.com/[email protected]/msg05619.html
Quote from above link:
其他答案中回答了链接图标。 创建这个东西就像使用 png2ico 一样简单。 它从 1 个或多个 png 创建一个 ico 文件并处理多种尺寸等,例如:
将创建尺寸为 16x16 和 32x32 的 myicon.ico。 尺寸必须是 8 平方的倍数,且不大于 256x256。
Linking the icons is answered in other answers. Creating the thing is as easy as using png2ico. It creates an ico file from 1 or more png's and handles multiple sizes etc, like:
Will create myicon.ico with sizes 16x16 and 32x32. Sizes must be multiples of 8 squares, and no larger than 256x256.
py2exe 有点过时,并已与 pyinstaller 一起继续(其本身也有点过时;svn 版本是最新的)
http://pyinstaller.python-hosting.com/
运行完 pyinstaller 的初始脚本后从 Makespec.py 生成规范文件,编辑规范文件并查找 EXE 部分。 在其末尾只需添加您的 ico 定义; 所以
将变为
也就是说,如果 mine.ico 文件与 Makespec.py 文件位于同一文件夹中。 还有一个命令行选项可以将图标输入其中。 我认为是
py2exe is a little dated, and has been continued with pyinstaller (which itself is a little dated; the svn release is the most up to date)
http://pyinstaller.python-hosting.com/
After running through the initial scripts for pyinstaller and generating the spec file from Makespec.py, edit the spec file and look for the EXE section. At the tail end of that just add in your ico definition; so
would become
That is, if the mine.ico file were in the same folder as the Makespec.py file. There's also a command line option for feeding the icon into it. I think it was
我没有使用 py2exe 的经验,但快速Google 搜索发现这个,如果您要求在 exe 文件中嵌入图标。
如果您想创建 .ico 文件,我强烈建议您搜索图标设计器或成品图标。 当然,您可以通过在 Paint 中创建 16x16、32x32 或 64x64 像素图像并将其重命名为 .ico 来相当轻松地创建 Win 3.x 样式图标。 但为 Windows 创建现代多分辨率图标要复杂得多。
(我正想问你是为什么操作系统编译的,当我意识到“exe”听起来很Windows,果然......)
I have no experience with py2exe but a quick google search found this, if embedding icons in exe files was what you asked for.
If you want to create .ico files, I'd really suggest you search for a icon designer or finished icons. Sure you can create a Win 3.x style icon fairly easy by creating a 16x16, 32x32, or 64x64 px image in paint, and rename it to .ico. But to create modern multi resolution icons for windows is a lot more complicated.
(I was about to ask what OS you was compiling for, when I realized "exe" sounds very windows, and sure enough...)