The later versions of wxGlade have been segfaulting on all my
wxPythonGTK2-2.4.2.4 (Fedora Core 2) systems. I've traced the problem back
to the img2py code for creating the wxBitmap in wxPalette (a component of
wxPyColourChooser).
The segfault appears to occur at the "zlib.decompress('....data here...')"
line (wxPython/lib/colourchooser/pypalette.py), but the wierd thing is
that if I copy that section code (the img2py-generated getData, getImage
and getBitmap functions) into a separate file and run it as a stand-alone
script, it runs fine. I've even saved data returned by getData() function
to a local file and get a .png type file containing the expected image. If
I modify pypalette.py to load the data directly from the file, it works
fine! However, in the standalone file, although the getData() function
returns OK (with apparently valid data), when I pass this data to
wxImageFromStream() it still segfaults.
Overall, this seems a very low level bug. Can anyone else confirm this?
A simple hack to wxPython for using wxGlade seems to be to copy the
palette image into the wxPython/lib/colourchooser/ directory and alter the
getImage function definition as:
def getImage():
#stream = cStringIO.StringIO(getData())
stream = file('/usr/lib/python2.3/site-packages/wxPython/lib/colourchooser/paletteimage.png')
img = wxImageFromStream(stream)
stream.close()
return img
I got the palette image by running the pypalette.getData() function in
a standalone script and saving the result to a file.
Note, I've come up against this a few times with my own code, where I've
used img2py before, so this bug has been around a while (at least in
fedora core 1 & 2 distributions).
Bryan