Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

keypress events cause unavoidable beep sound with wxagg #19658

Open
briantoby opened this issue Mar 6, 2021 · 2 comments
Open

keypress events cause unavoidable beep sound with wxagg #19658

briantoby opened this issue Mar 6, 2021 · 2 comments
Labels
GUI: wx keep Items to be ignored by the “Stale” Github Action

Comments

@briantoby
Copy link

Bug report

Bug summary

Pressing a key in a MPL plot causes a beep. This is not a serious problem, but is annoying.

Code for reproduction

use the code here https://matplotlib.org/stable/gallery/event_handling/keypress_demo.html, but add

import matplotlib
matplotlib.use('wxAgg')

Actual outcome

Every time a key is pressed, I hear a bell sound (a beep).

Expected outcome

I should be able to eliminate this using this in the callback:

def on_press(event):
    event.guiEvent.Skip(False)
    ...

The reason for this is in this callback handler in backend_wx.py

    def _onKeyDown(self, event):
        """Capture key press."""
        key = self._get_key(event)
        FigureCanvasBase.key_press_event(self, key, guiEvent=event)
        if self:
            event.Skip()

Since the method ends with event.Skip() (same as event.Skip(True)) the call to event.guiEvent.Skip(False) is ignored.
If this is rewritten as:

    def _onKeyDown(self, event):
        """Capture key press."""
        if self:
            event.Skip()
        key = self._get_key(event)
        FigureCanvasBase.key_press_event(self, key, guiEvent=event)

Then existing code will function as before, but there is the option to suppress the beep. One could argue that .Skip(False) should be the default, but that would be a change in how MPL functions.

Matplotlib version

  • Operating system: MacOS 10.15.7
  • Matplotlib version: 3.3.2
  • Matplotlib backend: MacOSX
  • Python version: 3.9.1
  • Jupyter version: N/A
  • Other libraries: wxpython 4.1.1

default conda channels except wxpython from pypi.

@anntzer anntzer added the GUI: wx label Mar 6, 2021
Copy link

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!

@github-actions github-actions bot added the status: inactive Marked by the “Stale” Github Action label Nov 22, 2023
@briantoby
Copy link
Author

I have not confirmed that the bug still exists, but looking at the current wx backend code, I don't think at present this issue has been addressed.

@oscargus oscargus added keep Items to be ignored by the “Stale” Github Action and removed status: inactive Marked by the “Stale” Github Action labels Nov 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GUI: wx keep Items to be ignored by the “Stale” Github Action
Projects
None yet
Development

No branches or pull requests

3 participants