Hello everyone,
Just a quick question, I'm trying to detect user logoff or a shutdown. I read that the wx.CloseEvent
has CanVeto(self) and GetLoggingOff(self). CanVeto(self) is apparently False if it's a shutdown (from
what I've read on Google) and True if it's a normal close event. GetLoggingOff(self) is True if the user
is logging off (and also if the user is using the system form my observation) and False if it's a shutdown
(from the wx docs). Does CanVeto(self) also return False if it's a logoff ? I can't really use GetLoggingOff(self)
since it returns true also if it's a normal (frame closed) event. Can I do something like the following :
def OnExit(self, event):
if(not event.CanVeto()): # shutdown or logoff
self.Destroy()
else:
dlg = wx.MessageDialog(self, "Are you sure you want to exit?", "Exit the application?", wx.YES_NO | wx.ICON_QUESTION | wx.NO_DEFAULT)
ans = dlg.ShowModal()
if(ans == wx.ID_YES):
self.Destroy()
dlg.Destroy()
Thank you,
Gabriel