[wxPython] Need help on wxOGL

Hi All,

I'm creating a instance of MyPage[which is derived from ogl class] as child
of wxNoteBook .
But OnCloseWindow function is not calling __del__ of MyPage class.

I've to explicitly call that in OnCloseWindow funtion.

where is the wrong?

···

-----Original Message-----
From: Mariappan, MaharajanX [mailto:m_mariappanX@trillium.com]
Sent: Wednesday, January 23, 2002 4:55 PM
To: 'wxpython-users@lists.wxwindows.org'
Subject: RE: [wxPython] Need help on wxOGL

Hi,

I'm getting the exact memory leaks eventhough i've defined the __del__
function.

15:55:01: There were memory leaks.
15:55:01: ----- Memory dump -----
15:55:01: wxDiagram at $10DDD40, size 32
15:55:01: wxObject at $10DDD98, size 28
15:55:01: wxPyRectangleShape at $888748, size 376
15:55:01: wxShapeRegion at $10DE128, size 144
15:55:01: wxShapeTextLine at $10DE630, size 32
15:55:01: wxPyShapeEvtHandler at $10DE948, size 32
15:55:01: wxPyRectangleShape at $10DEC40, size 376
15:55:01: wxShapeRegion at $10DEDF8, size 144
15:55:01: wxShapeTextLine at $10DF020, size 32
15:55:01: wxPyShapeEvtHandler at $10DF150, size 32
15:55:01: wxPyRectangleShape at $10DF298, size 376
15:55:01: wxShapeRegion at $10DF450, size 144
15:55:01: wxShapeTextLine at $10DF640, size 32
15:55:01: wxPyShapeEvtHandler at $10DF770, size 32
15:55:01: wxPyRectangleShape at $10DF920, size 376
15:55:01: wxShapeRegion at $10DFAD8, size 144
15:55:01: wxShapeTextLine at $10DFCC8, size 32
15:55:01: wxPyShapeEvtHandler at $10DFDF8, size 32
15:55:01: wxPyLineShape at $10E0080, size 464
15:55:01: wxShapeRegion at $10E02D8, size 144
15:55:01: wxShapeRegion at $10E0468, size 144
15:55:01: wxShapeRegion at $10E05A8, size 144
15:55:01: wxObject at $10E0880, size 28
15:55:01: wxPyLineShape at $10E0C48, size 464
15:55:01: wxShapeRegion at $10E0EA0, size 144
15:55:01: wxShapeRegion at $10E1030, size 144
15:55:01: wxShapeRegion at $10E1170, size 144
15:55:01: wxObject at $10E09A0, size 28
15:55:01: wxPyLineShape at $10E14C8, size 464
15:55:01: wxShapeRegion at $10E1720, size 144
15:55:01: wxShapeRegion at $10E18B0, size 144
15:55:01: wxShapeRegion at $10E19F0, size 144
15:55:01: wxObject at $10E1470, size 28
15:55:01:
15:55:01:
15:55:01: ----- Memory statistics -----
15:55:01: 3 objects of class wxPyLineShape, total size 1392
15:55:01: 4 objects of class wxPyShapeEvtHandler, total size 128
15:55:01: 4 objects of class wxShapeTextLine, total size 128
15:55:01: 13 objects of class wxShapeRegion, total size 1872
15:55:01: 4 objects of class wxPyRectangleShape, total size 1504
15:55:01: 4 objects of class wxObject, total size 112
15:55:01: 1 objects of class wxDiagram, total size 32
15:55:01:
15:55:01: Number of object items: 33
15:55:01: Number of non-object items: 0
15:55:01: Total allocated size: 5168
15:55:01:
15:55:01:

Any idea why?

-----Original Message-----
From: Young-Jin Lee [mailto:ylee12@uiuc.edu]
Sent: Tuesday, January 22, 2002 8:55 AM
To: wxpython-users@lists.wxwindows.org
Subject: Re: [wxPython] Need help on wxOGL

I found the answer in the sample code. I must have been blind yesterday. I
don't understand why I didn't find it.
In order to clean wxOGL object, the __del__ method should be implemented as
follows:
    def __del__( self ):
        for shape in self.diagram.GetShapeList():
            if shape.GetParent() == None:
                shape.SetCanvas(None)
                shape.Destroy()
        self.diagram.Destroy()

Sorry for messing up the mailing list. :frowning:
----- Original Message -----
From: "Young-Jin Lee" <ylee12@uiuc.edu>
To: <wxpython-users@lists.wxwindows.org>
Sent: Monday, January 21, 2002 7:43 PM
Subject: [wxPython] Need help on wxOGL

Hi, I'm looking for a help.
I was playing with wxOGL sample code. I copied several lines into my test
code and it worked, but when the test script quit, I got the memory leak
error message.
My rough guess from wxOGL.py example code is that I should do something

when

the window is closed.
I might be able to use the following code (from wxOGL.py), but I have no
idea what they are.
I already tied to add the following code at the end of my code, but it
didn't work.
Is there anybody to explain them?
###########################
class __Cleanup:
    cleanup = wxOGLCleanUp
    def __del__(self):
        self.cleanup()

# when this module gets cleaned up then wxOGLCleanUp() will get called
__cu = __Cleanup()

#############################

I also tried to manually clearn up wxOGL object by adding the Destroy()
method into my wxShapeCanvas object as follows:
    def Destroy( self ):
        wxOGLCleanUp()
        wxShapeCanvas.Destroy()

But neither worked.

Thanks in advance.

YJ

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwindows.org
http://lists.wxwindows.org/mailman/listinfo/wxpython-users

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwindows.org
http://lists.wxwindows.org/mailman/listinfo/wxpython-users

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwindows.org
http://lists.wxwindows.org/mailman/listinfo/wxpython-users

I'm creating a instance of MyPage[which is derived from ogl class] as

child

of wxNoteBook .
But OnCloseWindow function is not calling __del__ of MyPage class.

I've to explicitly call that in OnCloseWindow funtion.

where is the wrong?

If you've got extra references to the page window then __del__ won't be
called. That's just the way Python works.

···

--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!