Does your setup section contain a statement similar to:
console = [ {“script”: “zzz”, “icon_resources”: [(1, “yyy.ico”)], “other_resources”: [(24,1,manifest)] } ],
or
windows = [ {“script”: “zzz”, “icon_resources”: [(1, “yyy.ico”)], “other_resources”: [(24,1,manifest)] } ],
If yes, I can help.
Simply make sure to use keyword windows, not console.
···
On Saturday, August 29, 2015 at 4:56:23 AM UTC-4, Boštjan Mejak wrote:
How can I instruct py2exe’s build_exe that I don’t want that stupid console window to show when I run the created exe?
To hide the console, simply make sure to use keyword windows, not console.
The “icon_resources”: [(1, “yyy.ico”) statement should add an icon but I seem to remember there was an issue.
I set the icon in my application using self.SetIcon(“xyz.ico”)
Bruce
···
On Monday, August 31, 2015 at 4:17:48 PM UTC-4, Boštjan Mejak wrote:
The build_exe of py2exe is very limited. You can’t set to have the console hidden during the runtime of the produced executable. And also, you can’t set an icon for your executable application.
Would it be so hard to add 2 extra parser options for build_exe to hide the console and set an icon? Those are like the 2 most basic things that people want when making an executable from their scripts.
What do you think?
Anyone wanna share their setup.py script(s)? I also heard that setuptools is way better than distutils. If anyone has a setup.py script based on setuptools, I’d be very eager to see the script.
Personally I have not found a way to have the icon on the compiled exe itself without creating a setup script. Also, even when using a setup script the icon has to follow some guidelines or it wont show at all. Some info on that is HERE, and as some of the comments on the accepted answer state, if you are on Windows you may need to restart explorer.exe in order to see the icon. This is because Windows stores the fact your exe did not originally have an icon and to get it to re-cache this info explorer.exe needs killed and restarted. This is easy though (MAKE SURE YOU SAVE YOUR PROGRESS IN ANY OPEN PROGRAMS), open Task Manager, go to processes, right-click on Explorer.exe, select “End Process Tree”. You should be left with only Task Manager open, and in task manager click on File, select New Task (Run…) and type in explorer.exe to start it up again. If you go back to the folder your program is located the icon should now show.
Hope this helps
···
On Tuesday, September 1, 2015 at 5:42:52 AM UTC-4, Boštjan Mejak wrote:
Bruce, using the build_exe of py2exe (console command I use is this: python -m py2exe.build_exe myapp.py) I can’t seem to incorporate my icon globe.ico into the myapp.exe file when it’s created. Is there any way I can incorporate my icon globe.ico into the compiled EXE file myapp.exe? I am asking whether is there any other way not to use the setup.py script to incorporate the icon?
As for the 2 statements to hide the console, I am using windows = [ {“script”: “zzz”, “icon_resources”: [(1, “yyy.ico”)], “other_resources”: [(24,1,manifest)] } ] as a temporary solution.
I wanna avoid the use of the setup.py script altogether. So is there also a way to hide the console by compiling the EXE with the use of py2exe.build_exe?
You have a frequent and very bad habit of assuming that the things
YOU do are the things EVERYONE does.
Look, build_exe is a convenient shortcut. If the shortcut does what
you need, then life is good. If it doesn’t do what you need, then
you use a setup.py script. It’s just that simple. If build_exe
included every option that was usable from a script, it wouldn’t be
very convenient.
Alternatively, you could modify build_exe and contribute the changes
back to the project. That’s how open source works, and it would
make people a lot more inclined to listen to your moaning.
Long story short: your expectations are unreasonable. Build_exe
does what it was designed to do. If a tool was not designed to
solve the problem you have, that’s not the tool’s fault.
···
Boštjan Mejak wrote:
The build_exe of py2exe is very
limited. You can’t set to have the console hidden during the
runtime of the produced executable. And also, you can’t set an
icon for your executable application.
Would it be so hard to add 2 extra
parser options for build_exe to hide the console and ** set
an icon** ? Those are like the 2 most basic things that
people want when making an executable from their scripts.