本文介绍了如何指定py2app图标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用py2app时如何指定图标文件?

How do I specify the icon file when using py2app?

现在我创建安装文件:

py2applet --make-setup MyApplication.py

,然后构建应用程序捆绑包:

and then build the application bundle:

 python setup.py py2app -A

我在哪里指定图标文件.谢谢你的帮助.

where is it that I specify the icon file.. getting a little confused. Thanks for any help.

根据此链接- http://packages.python.org/py2app/options.html ,我应该将其添加为选项.

according to this link- http://packages.python.org/py2app/options.html, I should add it as an option.

当前,我的setup.py文件如下:

Currently my setup.py file looks like this:

"""
This is a setup.py script generated by py2applet

Usage:
    python setup.py py2app
"""

from setuptools import setup

APP = ['hello.py']
DATA_FILES = ['chalkboard.jpg']
OPTIONS = {'argv_emulation': True,
'iconfile': '/Users/grahamethomson/Documents/College/HND/oop/game/personal       developoment/G/icon.icns'}

setup(
    app=APP,
    data_files=DATA_FILES,
    options={'py2app': OPTIONS},
    setup_requires=['py2app'],
)

推荐答案

在setup.py中,添加图标文件

In your setup.py, add iconfile

"""
This is a setup.py script generated by py2applet

Usage:
    python setup.py py2app
"""

from setuptools import setup

APP = ['main.py']
DATA_FILES = []
OPTIONS = {
    'iconfile':'icon.icns',
    'plist': {'CFBundleShortVersionString':'0.1.0',}
}

setup(
    app=APP,
    name='MacApp',
    data_files=DATA_FILES,
    options={'py2app': OPTIONS},
    setup_requires=['py2app'],
)

这篇关于如何指定py2app图标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-16 03:16