No wx.App.Exit()?

Hi Josh,

I have hit a snag in my application design. My data is contained in
five XML files. My app needs to edit the information in those files,
and save them when closing. The docs talk about
calling the app.OnExit method, but it doesn't seem to exist. Is the
Exit() method essentially the same thing?

Whatever main window you have for your application (wx.Frame,
wx.Dialog, wx.MDIParentFrame and so on), you can do something like
that (self is your application main window):

self.Bind(wx.EVT_CLOSE, self.OnClose)

def OnClose(self, event):

    # Save your XML files and do your cleaning operations
    self.Destroy()
    event.Skip()

You could also try to catch the wx.EVT_QUERY_END_SESSION (but this
applies to the wx.App object, not to your main application window) to
detect, if everything goes well, the OS shutdown when something goes
really wrong.

On a more complicated note, can a wx.Panel find get information about
the App object?

Well, there is wx.GetApp().

I hope this helps.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.virgilio.it/infinity77/

ยทยทยท

On 3/25/07, Josh English wrote: