0

PyInstaller は、ユーザーが含めるフラグを誤解を招くように定義していますが、.icnsドキュメントに記載されているように、実際には何もしません。

-i FILE.ICO, -i FILE.EXE,ID, -i FILE.ICNS, --icon=FILE.ICO, --icon=FILE.EXE,ID, --icon=FILE.ICNS
If FILE is an .ico file, add the icon to the final executable. Otherwise, the syntax 'file.exe,id' to extract the icon with the specified id from file.exe and add it to the final executable. If FILE is an .icns file, add the icon to the final .app bundle on Mac OS X (for Mac not yet implemented)

だから、それはかなり絶望的でした。次善の策は、デフォルトの PyInstaller アイコンを自分のアイコンに置き換えることです。私はスクリプトでこれを行います:

pyinstaller -y --windowed  --name="foobar" --workpath="target/build" --distpath="target/dist" *.spec

# Update the icon: PyInstaller's -i switch is not implemented for Mac
cp "path/to/icon.icns" "target/dist/foobar.app/Contents/Resources/icon-windowed.icns"

ただし、プログラムでこれを行うと、アプリケーションが元の Python アイコンを持つものとして既に登録されているため、Finder が混乱することがわかりました。しかし、それは見つかりません。したがって、アプリケーションはアイコンなしで起動します。

アイコンを正しく設定するにはどうすればよいですか?

4

1 に答える 1