"PyInstaller packed combat Guide" fourth quarter to add the application icon

The fourth quarter to add the application icon

1. How to add icon

2. Why does not display the icon pack after


In this section, we will take you to learn how to add custom icon for the executable file, and solve a common problem icon pack.

 

1. How to add icon

First, we can go easyicon this site to download a file icon ico format, the author here to download a:

Links: https://www.easyicon.net/download/ico/1214130/128/

We will download good icon named smile.ico and placed in the project path:

Note: To download the icon pack .icns file format on Mac.

 

Then open command path directly under the item packaged command line window, enter the following:

pyinstaller -F -w -i ./smile.ico belle.py

Here is the new -i command to add icons to the program, we need to add an icon after the command path, the path may be a relative path, or an absolute path:

pyinstaller -F -w -i C:/Users/Desktop/la_vie/smile.ico belle.py

After the package is successful, we can see in the dist folder, add a custom icon of the executable file:

Note: The icon file has been packed in, so we can delete, will not have a relationship.

 

2. Why does not display the icon pack after

When you package an icon of the most common question is: obviously I have to use the command, the path also, why not pack the program display a custom icon?

The reason is that your ico file may be invalid. Many people like to get a direct ico file by modifying the extension, such as .png directly modified to .ico:

But doing so is likely to result if the file is invalid (even if they can open), so we had better help professional format conversion software (such as format factory) to the other format image files into icon ico (or .icns) format, or readers can easyicon find other suitable icons on this site.

 

It could also be due to the cache. In fact, packaging is a success, but did not appear in the dist folder. Readers simply generate executable file onto another folder (or directly onto the desktop) will find the icon displayed properly.

 

If not the above two reasons, please private letter to me.

Published 83 original articles · won praise 157 · Views 140,000 +

Guess you like

Origin blog.csdn.net/La_vie_est_belle/article/details/93749350