invalid bitmap for wxToolBar icon

I’ve attached my code. I’m using wxPython 3.0 on Debian Wheezy. I’m trying to set the images for a Toolbook. Here’s the error I encounter:

[…]
File “mytoolbook.py”, line 37, in init
tb.AddPage(pgOne, “PageOne”)
File “/usr/lib/python2.7/wx/_core.py”, line 13619, in AddPage
return core.BookCtrlBase_AddPage(*args, **kwargs)
wx._core.PyAssertionError: C++ assertion “bitmap.IsOk()” failed at /[scrubbed]/wxPython-src-3.0.0.0/src/gtk/toolbar.cpp(261) in SetImage(): invalid bitmap for wxToolBar icon

I’ve made my own images.py file to import by feeding my PNG files into img2py.py. I also tried saving my images as bitmap files and creating an images.py file by feeding image files into encode_bitmaps.py. I’d like to use py2exe when this project is finished, so that is why I am using img2py, but if I don’t need to that, that would also be good to know. Is there a simple mistake I’m making here?

mytoolbook.py (2.25 KB)

I tried the code sample you provided using my own custom images.py and did not experience the error that you did. However, it did not display my images. I tested with Python 2.7.5, wxPython 2.9.5.0 on Windows 7 32bit.

···

On Sunday, March 2, 2014 7:40:34 PM UTC-5, Matt Pagan wrote:

I’ve attached my code. I’m using wxPython 3.0 on Debian Wheezy. I’m trying to set the images for a Toolbook. Here’s the error I encounter:

[…]
File “mytoolbook.py”, line 37, in init
tb.AddPage(pgOne, “PageOne”)
File “/usr/lib/python2.7/wx/_core.py”, line 13619, in AddPage
return core.BookCtrlBase_AddPage(*args, **kwargs)
wx._core.PyAssertionError: C++ assertion “bitmap.IsOk()” failed at /[scrubbed]/wxPython-src-3.0.0.0/src/gtk/toolbar.cpp(261) in SetImage(): invalid bitmap for wxToolBar icon

I’ve made my own images.py file to import by feeding my PNG files into img2py.py. I also tried saving my images as bitmap files and creating an images.py file by feeding image files into encode_bitmaps.py. I’d like to use py2exe when this project is finished, so that is why I am using img2py, but if I don’t need to that, that would also be good to know. Is there a simple mistake I’m making here?