************* wx.CloseEvent ************* Inheritance diagram for `wx.CloseEvent`: | .. inheritance-diagram:: wx.CloseEvent | Description =========== This event class contains information about window and session close events. The handler function for ``wx.EVT_CLOSE`` is called when the user has tried to close a a frame or dialog box using the window manager (X) or system menu (Windows). It can also be invoked by the application itself programmatically, for example by calling the `wx.Window.Close <../Widgets/wx.Window.html#Close>`_ function. You should check whether the application is forcing the deletion of the window using `CanVeto <#CanVeto>`_. If this is ``False``, you **must** destroy the window using `wx.Window.Destroy <../Widgets/wx.Window.html#Destroy>`_. If the return value is ``True``, it is up to you whether you respond by destroying the window. If you don't destroy the window, you should call `Veto <#Veto>`_ to let the calling code know that you did not destroy the window. This allows the `wx.Window.Close <../Widgets/wx.Window.html#Close>`_ function to return ``True`` or ``False`` depending on whether the close instruction was honoured or not. .. seealso:: `wx.Window.Close <../Widgets/wx.Window.html#Close>`_ Derived From ^^^^^^^^^^^^^ * `wx.Event `_ Event Handling ^^^^^^^^^^^^^^ ================================================== ================================================== Event Name Description ================================================== ================================================== wx.EVT_CLOSE(func) Process a close event, supplying the member function. This event applies to `wx.Frame <../Widgets/wx.Frame.html>`_ and `wx.Dialog <../Widgets/wx.Dialog.html>`_ classes. wx.EVT_QUERY_END_SESSION(func) Process a query end session event, supplying the member function. This event applies to `wx.App <../Widgets/wx.App.html>`_ only. wx.EVT_END_SESSION(func) Process an end session event, supplying the member function. This event applies to `wx.App <../Widgets/wx.App.html>`_ only. ================================================== ================================================== Methods Summary ^^^^^^^^^^^^^^^ * `__init__ <#__init__>`_ * `CanVeto <#CanVeto>`_ * `GetLoggingOff <#GetLoggingOff>`_ * `GetVeto <#GetVeto>`_ * `SetCanVeto <#SetCanVeto>`_ * `SetLoggingOff <#SetLoggingOff>`_ * `Veto <#Veto>`_ Properties Summary ^^^^^^^^^^^^^^^^^^ * `LoggingOff <#LoggingOff>`_ Class API ========= Methods ^^^^^^^ .. method:: __init__(type=wx.wxEVT_NULL, winid=0) Constructor. **Parameters:** * `type` (eventtype) * `winid` (int) | **Returns:** `wx.CloseEvent `_ -------- .. method:: CanVeto(canVeto) Returns ``True`` if you can veto a system shutdown or a window close event. Vetoing a window close event is not possible if the calling code wishes to force the application to exit, and so this function must be called to check this. **Parameters:** * `canVeto` (bool) | **Returns:** `bool` -------- .. method:: GetLoggingOff() Returns ``True`` if the user is just logging off or ``False`` if the system is shutting down. This method can only be called for end session and query end session events, it doesn't make sense for close window event. | **Returns:** `bool` -------- .. method:: GetVeto() `No docstrings found for this method.` -------- .. method:: SetCanVeto(canVeto) Sets the 'can veto' flag. **Parameters:** * `canVeto` (bool) -------- .. method:: SetLoggingOff(loggingOff) Sets the 'logging off' flag. **Parameters:** * `loggingOff` (bool) -------- .. method:: Veto(veto=True) Call this from your event handler to veto a system shutdown or to signal to the calling application that a window close did not happen. You can only veto a shutdown if `CanVeto <#CanVeto>`_ returns ``True``. **Parameters:** * `veto` (bool) -------- Properties ^^^^^^^^^^ .. attribute:: LoggingOff See `GetLoggingOff <#GetLoggingOff>`_ and `SetLoggingOff <#SetLoggingOff>`_