Please Hlp with msg: "The C++ part of the StaticText object has been deleted"
Mike C. Fletcher
mcfletch at rogers.com
Sun Sep 26 03:06:11 EDT 2004
wxPyDeadObjectError is a catch that prevents you from getting a core
dump/memory-access-violation when you try to call a method or access an
attribute of an object which has already been cleaned up/destroyed by
the system. wxPyDeadObject's evaluate to false, so you can do this:
if self.testLab:
self.testLab.SetLabel('test')
or you can just catch the error:
try:
self.testLab.SetLabel( 'test' )
except wx.PyDeadObjectError, err:
pass # just ignore it...
In this case, it looks like the event is occurring after the testLab
widget has been destroyed. Since you likely don't want to change the
appearance of it at that point, nothing is lost.
HTH,
Mike
python newbie wrote:
...
> File "E:\MyProjects1\python\backup\wxProject.py", line 294, in
>OnNodeChanged
> self.testLab.SetLabel('test')
> File "C:\Python23\Lib\site-packages\wx\_core.py", line 10617, in
>__getattr__
> raise PyDeadObjectError(self.attrStr % self._name)
>wx._core.PyDeadObjectError: The C++ part of the StaticText object has been
>deleted, attribute access no longer allowed.
>
>
...
________________________________________________
Mike C. Fletcher
Designer, VR Plumber, Coder
http://www.vrplumber.com
http://blog.vrplumber.com
More information about the Python-list
mailing list