I need to generate an executable (onefile) from my tkinter application (one .pyw file).
PyInstaller myApp.pyw --onefile --icon=myIcon.ico
The build executable in dist folder looks good – the .exe file has the icon set.
But when I run it, the program shows again the default tkInter symbol in the top left and in the windows task bar.
So whats wrong here?
Python Version: 3.7.4
PyInstaller Version: 5.13.2
See Picture.
The pyinstaller --icon
option only sets the icon for the executable, not the window.
Setting the window icon will have to be done in the code. As you are using a .ico
file, this can be done using iconbitmap. Should be something like this:
import tkinter as tk
root = tk.Tk()
root.iconbitmap("myIcon.ico")
1