Retrieving a resource bitmap from a py2exe application
Artur Matos
arturmatos78 at yahoo.com
Mon Apr 2 07:33:43 PDT 2007
Hi to all,
I have an application that displays a fixed bitmap,
and I am packaging this application as a windows .exe
file, using py2exe. I am trying to add the bitmap as a
windows resource, so that it gets packaged inside the
.exe file. py2exe has a bitmap_resources options that
allow us to do this, so I've added something like this
to my setup.py file:
setup(
windows= [
{
...
"bitmap_resources": [(1, "a.bmp")
...
The problem is on how to access this bitmap from the
wxPython application. The wiki has some explanation on
how to do this for icons, but not for bitmaps. I have
tried to do something similar to what is written in
the wiki, something like this:
# 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)
But this is not working, and I only get an empty
bitmap. I have noticed that the wxWidgets C++
documentation has a wxBITMAP_TYPE_BMP_RESOURCE bitmap
type, so I thought that using that should solve the
problem, but this type is not defined in wxPython.
Does anyone has any sugestions to solve this? I am
using wxPython 2.8.
Best regards,
Artur Matos.
____________________________________________________________________________________
Bored stiff? Loosen up...
Download and play hundreds of games for free on Yahoo! Games.
http://games.yahoo.com/games/front
More information about the wxpython-users
mailing list