[wxPython-users] Retrieving a resource bitmap from a py2exe application

Andrea Gavana andrea.gavana at gmail.com
Mon Apr 2 07:56:58 PDT 2007


Hi Artur,

On 4/2/07, Artur Matos wrote:

<snip>
<snap>

> # Gets the name of the application
> exe_name =
> win32api.GetModuleFileName(win32api.GetModuleHandle(None))
> # Retrieves the bitmap
> bitmap = wx.Bitmap("%s;%s" % (exe_name, 1), wx.BITMAP_TYPE_BMP)

Shouldn't this be:

bitmap = wx.Bitmap("%s;%s" % (exe_name, 0), wx.BITMAP_TYPE_BMP)

?

Looking at the wiki, it seems that the ";number" declaration is
something zero-based. To specify the ID of the icon (like you did in
your sample), you need to use the *negated* id number, but in this
case you should change your ID from 1 to something else (i.e., 4) and
use:

bitmap = wx.Bitmap("%s;%s" % (exe_name, -4), wx.BITMAP_TYPE_BMP)

Does it work in this way?

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.virgilio.it/infinity77/




More information about the wxpython-users mailing list