Ian,
for what it is worth, I've always found using this sort of code works better
than the icon code you use. Don't know why. Karsten or someone alluded in a
previous post to the fact that wxPython seems to be very touchy around all
this bitmap/icon stuff. Certainly I've found in practice when creating
icons/bitmaps etc that even an apparently innocent bitmap or icon crashes the
system, one can re-create it in apparently the same manner and it dosn't.
I've temporarily hardcoded my file with a little house picture, but the code
under it should be generic enough to use instead of the icon code.
img = wx.Image
('/home/richard/gnumed/gnumed/client/bitmaps/home_path3232.png',
wx.BITMAP_TYPE_ANY)
==============================================
bmp = wx.BitmapFromImage (img)
imagelist.Add (bmp)
self.nb.AssignImageList (imagelist)
==============================================
Here's my error messages:
richard
[PANIC] (gnumed.py:address@hidden): Exception: Unhandled exception encountered.
[PANIC] (gnumed.py:address@hidden): exception type : wx._core.PyAssertionError
[PANIC] (gnumed.py:address@hidden): exception value: C++ assertion
"(bitmap.GetWidth() == m_width && bitmap.GetHeight() == m_height) || (m_width
== 0 && m_height == 0)" failed in ../src/generic/imaglist.cpp(81): invalid
bitmap size in wxImageList: this might work on this platform but definitely
won't under Windows.
[PANIC] (gnumed.py:address@hidden): Traceback (most recent call
last):<#10-0x0A-lf>
[PANIC] (gnumed.py:address@hidden): File "gnumed.py", line 309, in ?<#10-0x0A-lf>
gmGuiMain.main()<#10-0x0A-lf>
[PANIC] (gnumed.py:address@hidden): File
"/usr/lib/python2.3/site-packages/Gnumed/wxpython/gmGuiMain.py", line 640, in
main<#10-0x0A-lf> app = gmApp(0)<#10-0x0A-lf>
[PANIC] (gnumed.py:address@hidden): File
"/usr/src/wxPython-src-2.5.4.1/wxPython/wx/_core.py", line 5577, in
__init__<#10-0x0A-lf> self._BootstrapApp()<#10-0x0A-lf>
[PANIC] (gnumed.py:address@hidden): File
"/usr/src/wxPython-src-2.5.4.1/wxPython/wx/_core.py", line 5229, in
_BootstrapApp<#10-0x0A-lf> return _core_.PyApp__BootstrapApp(*args,
**kwargs)<#10-0x0A-lf>
[PANIC] (gnumed.py:address@hidden): File
"/usr/lib/python2.3/site-packages/Gnumed/wxpython/gmGuiMain.py", line 496, in
OnInit<#10-0x0A-lf> frame = gmTopLevelFrame(None, -1, _('GnuMed client'),
(640,440), gmCLI.arg.get ('--layout', None))<#10-0x0A-lf>
[PANIC] (gnumed.py:address@hidden): File
"/usr/lib/python2.3/site-packages/Gnumed/wxpython/gmGuiMain.py", line 131, in
__init__<#10-0x0A-lf> self.LayoutMgr = gmRichardSpace.cLayoutMgr(self,
-1)<#10-0x0A-lf>
[PANIC] (gnumed.py:address@hidden): File
"/usr/lib/python2.3/site-packages/Gnumed/wxpython/gmRichardSpace.py", line
64, in __init__<#10-0x0A-lf> self.__load_plugins()<#10-0x0A-lf>
[PANIC] (gnumed.py:address@hidden): File
"/usr/lib/python2.3/site-packages/Gnumed/wxpython/gmRichardSpace.py", line
126, in __load_plugins<#10-0x0A-lf> imagelist.AddIcon (icon)<#10-0x0A-lf>
[PANIC] (gnumed.py:address@hidden): File
"/usr/src/wxPython-src-2.5.4.1/wxPython/wx/_gdi.py", line 4432, in
AddIcon<#10-0x0A-lf> return _gdi_.ImageList_AddIcon(*args,
**kwargs)<#10-0x0A-lf>
[PANIC] (gnumed.py:address@hidden): PyAssertionError: C++ assertion
"(bitmap.GetWidth() == m_width && bitmap.GetHeight() == m_height) || (m_width
== 0 && m_height == 0)" failed in ../src/generic/imaglist.cpp(81): invalid
bitmap size in wxImageList: this might work on this platform but definitely
won't under Windows.<#10-0x0A-lf>
_______________________________________________
Gnumed-devel mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/gnumed-devel
imagelist = wx.ImageList (16, 16)
default_bitmap = None
for i in self.plugins:
png_fname =
os.path.join(self.__gb['gnumed_dir'], 'bitmaps', '%s.png' % getattr
(i, "icon", i.__class__.__name__))
icon = wx.EmptyIcon()
if not os.access (png_fname, os.R_OK):
png_fname =
os.path.join(self.__gb['gnumed_dir'], 'bitmaps', 'serpent.png')
icon.LoadFile(png_fname, wx.BITMAP_TYPE_PNG)
icon.SetWidth(16)
icon.SetHeight(16)
imagelist.AddIcon (icon)
self.nb.AssignImageList (imagelist)