Close(self)
This function simply generates a EVT_CLOSE event whose handler usually
tries to close the window. It doesn't close the window itself,
however. If force is False (the default) then the window's close
handler will be allowed to veto the destruction of the window.
Usually Close is only used with the top level windows (wx.Frame and
wx.Dialog classes) as the others are not supposed to have any special
EVT_CLOSE logic.
The close handler should check whether the window is being deleted
forcibly, using wx.CloseEvent.GetForce, in which case it should
destroy the window using wx.Window.Destroy.
Note that calling Close does not guarantee that the window will be
destroyed; but it provides a way to simulate a manual close of a
window, which may or may not be implemented by destroying the
window. The default EVT_CLOSE handler for wx.Dialog does not
necessarily delete the dialog, since it will simply simulate an
wxID_CANCEL event which is handled by the appropriate button event
handler and may do anything at all.
To guarantee that the window will be destroyed, call wx.Window.Destroy
instead.
-
- Overrides:
wx.Window.Close
|