wx.CloseEvent

Inheritance diagram for 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 function.

You should check whether the application is forcing the deletion of the window using CanVeto. If this is False, you must destroy the window using wx.Window.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 to let the calling code know that you did not destroy the window. This allows the wx.Window.Close function to return True or False depending on whether the close instruction was honoured or not.

See also

wx.Window.Close

Derived From

Event Handling

Event Name Description
wx.EVT_CLOSE(func) Process a close event, supplying the member function. This event applies to wx.Frame and wx.Dialog classes.
wx.EVT_QUERY_END_SESSION(func) Process a query end session event, supplying the member function. This event applies to wx.App only.
wx.EVT_END_SESSION(func) Process an end session event, supplying the member function. This event applies to wx.App only.

Properties Summary

Class API

Methods

__init__(type=wx.wxEVT_NULL, winid=0)

Constructor.

Parameters:

  • type (eventtype)
  • winid (int)

Returns:

wx.CloseEvent


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


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


GetVeto()
No docstrings found for this method.

SetCanVeto(canVeto)

Sets the ‘can veto’ flag.

Parameters:

  • canVeto (bool)

SetLoggingOff(loggingOff)

Sets the ‘logging off’ flag.

Parameters:

  • loggingOff (bool)

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 returns True.

Parameters:

  • veto (bool)

Properties

LoggingOff
See GetLoggingOff and SetLoggingOff