How to close wxGrid located inside wxFrame

Cliff Wells logiplexsoftware at earthlink.net
Mon Apr 1 13:47:14 EST 2002


On Mon, 01 Apr 2002 20:51:12 +0300
Pekka Niiranen wrote:

> Hi,
> 
>     how should I define the OnExit -method in MainFrame -class below
>     so that wxWindows would not leak memory, when "Exit" is selected
>     from the menu. I should somehow close the grid before the frame, but
> how ?

The grid should be automatically destroyed when its parent is.  If for some
reason you do need to manually destroy it, this should work:

    def OnExit(self, event):
        # Close program
	self.pn_grid.Destroy()
        self.Close(true)

You'll of course have to change the line where you instantiate pn_grid
from:
        # Create grid
        pn_grid = PnGrid(self)

To:
        # Create grid
        self.pn_grid = PnGrid(self)



-- 
Cliff Wells, Software Engineer
Logiplex Corporation (www.logiplex.net)
(503) 978-6726 x308  (800) 735-0555 x308




More information about the Python-list mailing list