I got an error, after making some modification to my program:
Fatal Python error: (pygame parachute) Segmentation Fault
But after removing all pygame references,
the error still existed.
Further investigation revealed,
that assigning the same imagelist to two different wx.NoteBooks
was causing the problems.
Why isn't this allowed ?
The idea is, that I generate a huge imagelist once,
and use it for all kind of purposes.
This was thé way to handle imagelist in Delphi.
Should I generate an imagelist for each wx.widget separately ?
I got an error, after making some modification to my program:
Fatal Python error: (pygame parachute) Segmentation Fault
But after removing all pygame references,
the error still existed.
Further investigation revealed,
that assigning the same imagelist to two different wx.NoteBooks
was causing the problems.
Why isn't this allowed ?
Because you are assigning ownership of the image list to both notebooks and so both are trying to destroy it. If you want to share it then use SetImageList and then you'll also need to keep a Python reference to it. The Python reference will then own the image list and the notebooks will not try to destroy it.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
On Tue, Apr 28, 2009 at 2:31 PM, Stef Mientki <s.mientki@ru.nl> wrote:
hello,
I got an error, after making some modification to my program:
Fatal Python error: (pygame parachute) Segmentation Fault
But after removing all pygame references,
the error still existed.
Further investigation revealed,
that assigning the same imagelist to two different wx.NoteBooks
was causing the problems.
Why isn't this allowed ?
IIRC AssignImageList will tell the widget to take ownership of the
imagelists memory. If you want to use it in muliple places I think you
need to call SetImageList instead and then manage the reference to the
ImageList yourself.
I got an error, after making some modification to my program:
Fatal Python error: (pygame parachute) Segmentation Fault
But after removing all pygame references,
the error still existed.
Further investigation revealed,
that assigning the same imagelist to two different wx.NoteBooks
was causing the problems.
Why isn't this allowed ?
Because you are assigning ownership of the image list to both notebooks and so both are trying to destroy it. If you want to share it then use SetImageList and then you'll also need to keep a Python reference to it. The Python reference will then own the image list and the notebooks will not try to destroy it.
thanks Robin,
that solves the crash problem, but ...
For as far as I can see in the documentation, SetImageList should be used identical as AssignImageList.
But with Set ImageList I don't see any images on the Notebook tabs
2.8.7.1 (msw-unicode)
I got an error, after making some modification to my program:
Fatal Python error: (pygame parachute) Segmentation Fault
But after removing all pygame references,
the error still existed.
Further investigation revealed,
that assigning the same imagelist to two different wx.NoteBooks
was causing the problems.
Why isn't this allowed ?
Because you are assigning ownership of the image list to both notebooks and so both are trying to destroy it. If you want to share it then use SetImageList and then you'll also need to keep a Python reference to it. The Python reference will then own the image list and the notebooks will not try to destroy it.
thanks Robin,
that solves the crash problem, but ...
For as far as I can see in the documentation, SetImageList should be used identical as AssignImageList.
But with Set ImageList I don't see any images on the Notebook tabs
2.8.7.1 (msw-unicode)
Probably because you are not holding a Python reference to the image list object, so it is being garbage collected.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
First one says takes ownership, second one says does Not take ownership.
But with Set ImageList I don't see any images on the Notebook tabs
2.8.7.1 (msw-unicode)
.Are you keeping a reference in your code to the ImageList you created
(as Robin mentioned you need to). With AssignImage list you can just
pass it to the control and forget about it, but with SetImageList you
need to keep a reference to it somewhere where it will not get garbage
collected till your done with it.
i.e)
self.imgLst = wx.ImageList(...)
Cody
···
On Tue, Apr 28, 2009 at 4:15 PM, Stef Mientki <s.mientki@ru.nl> wrote:
I got an error, after making some modification to my program:
Fatal Python error: (pygame parachute) Segmentation Fault
But after removing all pygame references,
the error still existed.
Further investigation revealed,
that assigning the same imagelist to two different wx.NoteBooks
was causing the problems.
Why isn't this allowed ?
Because you are assigning ownership of the image list to both notebooks and so both are trying to destroy it. If you want to share it then use SetImageList and then you'll also need to keep a Python reference to it. The Python reference will then own the image list and the notebooks will not try to destroy it.
thanks Robin,
that solves the crash problem, but ...
For as far as I can see in the documentation, SetImageList should be used identical as AssignImageList.
But with Set ImageList I don't see any images on the Notebook tabs
2.8.7.1 (msw-unicode)
It does work indeed,
I assigned the image list to a local variable and that gets lost.
Wouldn't it be better to remove "AssignImageList",
it might be valuable in some rare cases,
but in general, someone using such a high level package as wxPython,
shouldn't bother about this kind of details.
Wouldn't it be better to remove "AssignImageList",
it might be valuable in some rare cases,
but in general, someone using such a high level package as wxPython,
shouldn't bother about this kind of details.
This is a very dangerous line of thinking. Just because a tool is sharp
enough to cut you does NOT mean that it should be destroyed. If you
removed AssignImageList, then there would be no way at all to change the
ownership of the object, and there are certainly sophisticated wxPython
users who need to be able to do that. The better solution is to make
sure users understand what ownership is all about, so that you will be
able to select the proper API when you need it. Ownership is a key
concept, and it should not be easy for you to ignore it.
As an aside, wxPython is not all that high level. There are some
higher-level components included with wxPython, but on the whole
wxPython is a very thin layer over wxWidgets, which is itself a
relatively thin layer over the Win32 (or X) GUI APIs.
Dabo is what I would call a high-level API.
···
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.