wx.Event

Inheritance diagram for wx.Event:



Description

An event is a structure holding information about an event passed to a callback or member function. wx.Event used to be a multipurpose event object, and is an abstract base class for other event classes.

Derived From

Class API

Methods

__init__(id=0, eventType=wx.wxEVT_NULL)

Constructor. Should not need to be used directly by an application.

Parameters:

  • id (int)
  • eventType (eventtype)

Returns:

wx.Event


Clone()

Returns a copy of the event.

Any event that is posted to the wxWidgets event system for later action (via wx.EvtHandler.AddPendingEvent or wx.PostEvent) must implement this method. All wxWidgets events fully implement this method, but any derived events implemented by the user should also implement this method just in case they (or some event derived from them) are ever posted.


Returns:

wx.Event


GetEventObject()

Returns the object (usually a window) associated with the event, if any.


Returns:

wx.Object


GetEventType()

Returns the identifier of the given event type, such as wx.wxEVT_COMMAND_BUTTON_CLICKED.


Returns:

int


GetId()

Returns the identifier associated with this event, such as a button command id.


Returns:

int


GetSkipped()

Returns True if the event handler should be skipped, False otherwise.


Returns:

bool


GetTimestamp()

Gets the timestamp for the event. The timestamp is the time in milliseconds since some fixed moment (not necessarily the standard Unix Epoch, so only differences between the timestamps and not their absolute values usually make sense).


Returns:

long


IsCommandEvent()

Returns True if the event is or is derived from wx.CommandEvent else it returns False.


Returns:

bool

Note

This method exists only for optimization purposes.


ResumePropagation(propagationLevel)

Sets the propagation level to the given value (for example returned from an earlier call to StopPropagation).

Parameters:

  • propagationLevel (int)

SetEventObject(object)

Sets the originating object.

Parameters:


SetEventType(type)

Sets the event type.

Parameters:

  • type (int)

SetId(id)

Sets the identifier associated with this event, such as a button command id.

Parameters:

  • id (int)

SetTimestamp(timeStamp)

Sets the timestamp for the event.

Parameters:

  • timeStamp (long)

ShouldPropagate()

Test if this event should be propagated or not, i.e. if the propagation level is currently greater than 0.


Returns:

bool


Skip()

This method can be used inside an event handler to control whether further event handlers bound to this event will be called after the current one returns. Without Skip() (or equivalently if Skip(False) is used), the event will not be processed any more. If Skip(True) is called, the event processing system continues searching for a further handler function for this event, even though it has been processed already in the current handler.

In general, it is recommended to skip all non-command events to allow the default handling to take place. The command events are, however, normally not skipped as usually a single command such as a button click or menu item selection must only be processed by one handler.


StopPropagation()

Stop the event from propagating to its parent window.

Returns the old propagation level value which may be later passed to ResumePropagation to allow propagating the event again.


Returns:

int


Properties

EventObject
See GetEventObject and SetEventObject
EventType
See GetEventType and SetEventType
Id
See GetId and SetId
Skipped
See GetSkipped
Timestamp
See GetTimestamp and SetTimestamp