Inheritance diagram for wx.MouseEvent:
This event class contains information about the events generated by the mouse: they include mouse buttons press and release events and mouse move events.
All mouse events involving the buttons use wx.MOUSE_BTN_LEFT for the left mouse button, wx.MOUSE_BTN_MIDDLE for the middle one and wx.MOUSE_BTN_RIGHT for the right one.
Note
Note that not all mice have a middle button so a portable application should avoid relying on the events from it.
Note
Note the difference between methods like LeftDown and LeftIsDown: the former returns True when the event corresponds to the left mouse button click while the latter returns True if the left mouse button is currently being pressed. For example, when the user is dragging the mouse you can use LeftIsDown to test whether the left mouse button is (still) depressed. Also, by convention, if LeftDown returns True, LeftIsDown will also return True in wxWidgets whatever the underlying GUI behaviour is (which is platform-dependent). The same applies, of course, to other mouse buttons as well.
Event Name | Description |
---|---|
wx.EVT_LEFT_DOWN(func) | Process a wx.wxEVT_LEFT_DOWN event. The handler of this event should normally call event.Skip() to allow the default processing to take place as otherwise the window under mouse wouldn’t get the focus. |
wx.EVT_LEFT_UP(func) | Process a wx.wxEVT_LEFT_UP event. |
wx.EVT_LEFT_DCLICK(func) | Process a wx.wxEVT_LEFT_DCLICK event. |
wx.EVT_MIDDLE_DOWN(func) | Process a wx.wxEVT_MIDDLE_DOWN event. |
wx.EVT_MIDDLE_UP(func) | Process a wx.wxEVT_MIDDLE_UP event. |
wx.EVT_MIDDLE_DCLICK(func) | Process a wx.wxEVT_MIDDLE_DCLICK event. |
wx.EVT_RIGHT_DOWN(func) | Process a wx.wxEVT_RIGHT_DOWN event. |
wx.EVT_RIGHT_UP(func) | Process a wx.wxEVT_RIGHT_UP event. |
wx.EVT_RIGHT_DCLICK(func) | Process a wx.wxEVT_RIGHT_DCLICK event. |
wx.EVT_MOTION(func) | Process a wx.wxEVT_MOTION event. |
wx.EVT_ENTER_WINDOW(func) | Process a wx.wxEVT_ENTER_WINDOW event. |
wx.EVT_LEAVE_WINDOW(func) | Process a wx.wxEVT_LEAVE_WINDOW event. |
wx.EVT_MOUSEWHEEL(func) | Process a wx.wxEVT_MOUSEWHEEL event. |
wx.EVT_MOUSE_EVENTS(func) | Process all mouse events. |
Constructs a wx.MouseEvent. Valid event types are:
Parameters:
Returns:
Returns True if the Alt key was down at the time of the event.
Returns:
bool
If the argument is omitted, this returns True if the event was a mouse double click event.
Otherwise the argument specifies which double click event was generated (see GetButton for the possible values).
Parameters:
Returns:
bool
If the argument is omitted, this returns True if the event was a mouse button down event.
Otherwise the argument specifies which button-down event was generated (see GetButton for the possible values).
Parameters:
Returns:
bool
Parameters:
Returns:
bool
If the argument is omitted, this returns True if the event was a mouse button up event.
Otherwise the argument specifies which button-down event was generated (see GetButton for the possible values).
Parameters:
Returns:
bool
Same as MetaDown under Mac, same as ControlDown elsewhere.
Returns:
bool
See also
Returns True if the control key was down at the time of the event.
Returns:
bool
Returns True if this was a dragging event (motion while a button is depressed).
Returns:
bool
See also
Returns True if the mouse was entering the window.
Returns:
bool
See also
Returns the mouse button which generated this event or wx.MOUSE_BTN_NONE if no button is involved (for mouse move, enter or leave event, for example).
Otherwise wx.MOUSE_BTN_LEFT is returned for the left button down, up and double click events, wx.MOUSE_BTN_MIDDLE and wx.MOUSE_BTN_RIGHT for the same events for the middle and the right buttons respectively.
Returns:
int
Returns the configured number of lines (or whatever) to be scrolled per wheel action.
Defaults to three.
Returns:
int
Returns the logical mouse position in pixels (i.e. translated according to the translation set for the DC, which usually indicates that the window has been scrolled).
Parameters:
Returns:
Note
Note that if the mouse event has been artificially generated from a special keyboard combination (e.g. under Windows when the “menu” key is pressed), the returned position is wx.DefaultPosition.
Returns the pixel position of the mouse in window coordinates when the event happened.
Returns:
(x,y)
Get wheel delta, normally 120.
This is the threshold for action to be taken, and one such action (for example, scrolling one increment) should occur for each delta.
Returns:
int
Get wheel rotation, positive or negative indicates direction of rotation.
Current devices all send an event when rotation is at least +/-WheelDelta, but finer resolution devices can be created in the future. Because of this you shouldn’t assume that one event is equal to 1 line, but you should be able to either do partial line scrolling or wait until several events accumulate before scrolling.
Returns:
int
Returns X coordinate of the physical mouse event position.
Returns:
long
Returns Y coordinate of the physical mouse event position.
Returns:
long
Returns True if the event was a mouse button event (not necessarily a button down event - that may be tested using ButtonDown).
Returns:
bool
Returns True if the system has been setup to do page scrolling with the mouse wheel instead of line scrolling.
Returns:
bool
Returns True if the mouse was leaving the window.
Returns:
bool
See also
Returns True if the event was a left double click.
Returns:
bool
Returns True if the left mouse button changed to down.
Returns:
bool
Returns True if the left mouse button is currently down, independent of the current event type.
Please notice that it is not the same as LeftDown which returns True if the event was generated by the left mouse button being pressed. Rather, it simply describes the state of the left mouse button at the time when the event was generated (so while it will be True for a left click event, it can also be True for a right click if it happened while the left mouse button was pressed).
This event is usually used in the mouse event handlers which process “move mouse” messages to determine whether the user is (still) dragging the mouse.
Returns:
bool
Returns True if the left mouse button changed to up.
Returns:
bool
Returns True if the Meta key was down at the time of the event.
Returns:
bool
Returns True if the event was a middle double click.
Returns:
bool
Returns True if the middle mouse button changed to down.
Returns:
bool
Returns True if the middle mouse button is currently down, independent of the current event type.
Returns:
bool
Returns True if the middle mouse button changed to up.
Returns:
bool
Returns True if this was a motion event and no mouse buttons were pressed.
If any mouse button is held pressed, then this method returns False and Dragging returns True.
Returns:
bool
Returns True if the event was a right double click.
Returns:
bool
Returns True if the right mouse button changed to down.
Returns:
bool
Returns True if the right mouse button is currently down, independent of the current event type.
Returns:
bool
Returns True if the right mouse button changed to up.
Returns:
bool
Returns True if the shift key was down at the time of the event.
Returns:
bool