0

I am creating a small search-bar in pyqt and converting it into a exe, i am also assigning it an icon with QIcon, and while im converting it to exe, that time also I am using the same icon. The issue is that when i give that exe to someone else, the window's icon doesn't work and shows the default icon which i do not want.. Now there are two questions i have... 1. can i somehow embed the icon inside my script??

and if i can't 2. how can i disable the default icon..

Thanks.

Marcos Gonzalez
  • 1,086
  • 2
  • 12
  • 19
abhishekgarg
  • 1,480
  • 9
  • 14

1 Answers1

1

I don't use these exe converters, but I'm assuming it isn't packing the image file in the executable, in this case you have to take a look on the manual and see if there's a way to force that file manually (or tell us what exe packer you're using).

You can of course, embed the image in the source file itself, I recommend using base64 for that (http://docs.python.org/2/library/base64.html). You can 'embed' any data in the code using it. Considering that an application icon is generally a PNG of few bytes, it's not a bad idea imho.

However, I don't recommend using an exe converter (and packing everything in a single exe), I suggest you use a 'fancy installer' and try reproducing the "clients" environments (in terms of dependencies) as consistently as possible... So you ship a single exe that 'unpacks' the entire structure, including dependencies, so in case you release an update, the download is probably going to be minimal (probably you won't need to update the interpreter and libs often). If you don't want to ship the 'py' files (although in some way you're always shipping them (at least the 'pycs')), there are exe packers that creates separated files. Best Regards.

  • Okay, it seems this occurs because pyinstaller doesn't detects the files being loaded by external stuff like the PyQt lib/wrapper. Did you try [this](http://stackoverflow.com/questions/11534293/pyinstaller-wont-load-the-pyqts-images-to-the-gui)? It seems you're going to have problems with all types of images, not only the icon, and the proper solution is by manually pointing pyinstaller to the resources. If you're not going to need images besides the icon, you can safely embed it on code using base64. Also, you could try only specifying the icon using the argument "--icon" for MakeSpec.py. Reg –  Jun 12 '13 at 20:03