[wxPython] How to suppress a wxShape using wxOGL ?

Hello,

I'm having trouble supressing shapes using OGL. I started with the code
from the demo, and added an OnChar method in the TestWindow class:

    def OnChar(self,event):
        if event.KeyCode()== WXK_DELETE :
            dc = wxClientDC(self)
            self.PrepareDC(dc)
            for shape in filter(lambda s: s.Selected(),
self.diagram.GetShapeList()):
                shape.Select(false,dc)
                for line in shape.GetLines():
                    line.Unlink()
                    line.Erase(dc)
                    line.SetCanvas(None)
                    line.Destroy()
                shape.Erase(dc)
                shape.SetCanvas(None)
                shape.Destroy()

Now, when this method runs, the shape does disappear from the canvas,
however, if I try to select another shape, the application crashes
(access violation -- coredump)

I'm using wxPython 2.1.15 on Windows NT4 SP4 workstation, and python
1.5.2

Thanks in advance

Alexandre Fayolle

It appears that the following code works (ie: suppressing the calls to
SetCanvas(None) :

    def OnChar(self,event):
        if event.KeyCode()== WXK_DELETE :
            dc = wxClientDC(self)
            self.PrepareDC(dc)
            for shape in filter(lambda s: s.Selected(),
self.diagram.GetShapeList()):
                shape.Select(false,dc)
                for line in shape.GetLines():
                    line.Unlink()
                    line.Erase(dc)
                    #line.SetCanvas(None)
                    line.Destroy()
                shape.Erase(dc)
                #shape.SetCanvas(None)
                shape.Destroy()

Alexandre Fayolle