setting icon using py2exe?

simo simoninusa2001 at yahoo.co.uk
Thu Jul 1 01:42:58 EDT 2004


Grant Edwards <grante at visi.com> wrote:

[snip]
> > This works fine for me on Windows 98SE/XP/2000:
 
> Are you sure it works on 98SE?  Others have reported it only
> works on NT/2K/XP.

Well I don't know about *building* in 98SE (I only use 2000/XP for
development) but the resulting binary certainly incorporates the icon
in 98SE/NT4/2000/XP.

[...]
> > If you can't get this to work, you could just include the .ico file
> > using data_files=["hellow.ico"], and then create the shortcuts,
> > pointing to the icon, using your install program, e.g. InnoSetup
> > (kinda like I do under Linux).
 
> I've done that.  The desktop icon and start menu icon are set
> by InnoSetup, but the icon doesn't show up in the window banner
> or in the task bar.  I was assuming that setting the icon
> resource in the executable would fix that.

No, you have to set the icon from wxPython for the TaskBar and window
icon, py2exe only fixes the *executable's* icon (in Explorer).

In your mainWindow(wx.Frame) do:

  self.icon = wx.Icon("hellow.ico", wx.BITMAP_TYPE_ICO)
  self.SetIcon(self.icon)

This works on Linux too (for window and Panel), which I was quite
pleased with, especially as I didn't even do an XPM version, just the
ICO file....



More information about the Python-list mailing list