FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[ENH]: Add buttons (plural) attribute to mouseevents · Issue #23490 · matplotlib/matplotlib · GitHub

Repository navigation

[ENH]: Add buttons (plural) attribute to mouseevents #23490

Closed

Description

Problem

Currently, motion_notify_event generates a MouseEvent with a .button attribute that is generated by dead-reckoning: it fills that value by tracking button_press_events and button_release_events. This means that the value can be wrong (if the user starts pressing a button (keeping it pressed), moves the mouse out of the canvas, presses another button, releases the first one, moves back over the canvas), and also this cannot represent the case of multiple buttons being pressed (for a motion_notify_event, the main thing that makes sense to report is really "what are all pressed buttons", not "what was the last pressed button").

Proposed solution

Similarly to #23473, one could add a .buttons attribute (a frozenset of MouseButtons) to MouseEvents (well, at least to those generated by motion_notify_event) and fill that accordingly, as UI toolkits typically report that info (e.g. https://doc.qt.io/qt-6/qsinglepointevent.html#buttons, compare with https://doc.qt.io/qt-6/qsinglepointevent.html#button).

I think (assuming we can get #23473 in, which would mean we agree on this kind of API) we can tag this "good first issue"/"medium" as the new API would be well-defined but the work requires understanding various UI toolkits.

Activity

  1. github-actions commented on Dec 17, 2025

    This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!

  2. QuLogic commented on Dec 17, 2025

    Member

    This was implemented in #28453, I believe.

  3. added this to the v3.10.0 milestone on Dec 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL