Changing the taskbar icon when using pdeploy?

Hey all-

I created a program and built an installer for it using pdeploy, no problem. The installed game runs perfectly on my system (Windows 7) save for the taskbar icon… I seem to be unable to change it from the default PandaIcon.ico to one of my own icons. Strangely, the desktop and start menu icons that are generated by the installer are both correct / are not PandaIcon.ico. I feel like specifying the taskbar icon is supposed to be easy and I’m simply overlooking something.

I think the problem is that I’m not specifying the appropriate argument when converting my .py to a .p3d file. When I use packp3d I do

packp3d -o eralandsdemo.p3d -d C:\Python27\Islands\EralandsDemo -r openal -r morepy

and as a result my title bar goes from this when executing my .py file (from having the correct title and the icon on the window)


to this in my p3d file (to having the correct title but missing the icon)


and then those icons in the p3d file transfer over to the .exe when I use pdeploy. The same pattern also takes place when I use ppackage instead of packp3d. I’m under the impression that the missing line of code falls within the config section of my pdef file even though I’m using WindowProperties.setIconFilename within my program’s main.py.

#My pdef file
import sys
sys.path.insert(0,'')
print sys.path

class EralandsDemo(p3d):
    require("panda3d")
    require("morepy")

    config(display_name = "Eralands Demo")

    dir('Images',newDir='Images')
    dir('Textures',newDir='Textures')
    dir('Models',newDir='Models')
    dir('Particles',newDir='Particles')
    dir('Sounds',newDir='Sounds')
    
    file ("C:/Python27/Islands/EralandsDemo/icon.ico", extract = True)

    mainModule("main", filename = Filename('C:/Python27/Islands/EralandsDemo/main.py'))

Also to note: multify tells me the .ico file has been successfully packaged with the installer.

Lastly, I was able to get the desired effect plus a “bonus window” using the now-deprecated packpanda…


…but I’d prefer to know of a way to get my icon on the taskbar using pdeploy (or something similar) seeing how pdeploy also allows me to build installers for both OS X and Linux. Any suggestions? And thanks!

How are you calling pdeploy? Are you using the -i option with it?

Ah, right, sorry I forgot to post that. I have been using the -i option as it’s shown in the Panda3d manual.

C:\Python27\Islands\EralandsDemo>pdeploy -n eralandsdemo -N "Eralands Demo" -v 0.9.1 -o C:\Python27\Islands\EralandsInstaller -P win32 -s -a kyl -A "kyl" -t width=800 -t height=600 -i icon16.png -i icon32.png -i icon48.png -i icon128.png eralandsdemo.p3d installer

I’ve also tried specifying the -i option using the full directory of the png file names (e.g. -i C:\Python27\Islands\EralandsDemo\icon16.png) as well as switching the extension from .png to .PNG in the off chance that had an effect.

In all cases the desktop shortcut and the start menu icon generated by the installer remained correct but the taskbar icon is still that of PandaIcon.ico.

Hmm, I’ll take a look. I’ll get back to you.

Alright, sounds good. And thank you! I appreciate the help.

Hmm, it’s a bit of a tricky issue, because the Windows API function we use for setting the icon works can only work with files and so we can’t load icons from Panda’s virtual file system. I’ll see about whether we can let pdeploy extract it to disk or something.

I seem to recall that there was a similar situation regarding cursors under Windows. I forget whether that was resolved, but if not, it might be worth applying whatever fix you come up with to cursor-files as well.

Ah yes, while looking for a solution for the icons I think I found the mouse cursor thread that Thaumaturge is referencing. It seems that a workaround is to create a package and reference the package with the p3d file before converting it with pdeploy. Maybe that’'ll work for the icons as well? I’ll have to give it shot once I read up on how to build packages.

If pdeploy could extract an icon to disk sometime in the future that would be super helpful. I hope this works out!

Thanks again for all the help.

Can’t the icon be packed into the deployed .exe file?

Yeah. I’ve implemented extraction for pdeploy in the latest packp3d, available from:

When building a self-contained installer it will extract the .ico from the archive. With the -x option in the packp3d command-line you can add additional extensions that should be extracted.

This seems like a potentially-useful option to have–thank you for it. :slight_smile: