Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

webAgg backend incorrectly reports middle clicks as right clicks #18171

Closed
@ianhi

Description

@ianhi

Bug report

Bug summary
The webAgg backend reports middle click events as right click events. This is caused by these lines:

# The right mouse button pops up a context menu, which
# doesn't work very well, so use the middle mouse button
# instead. It doesn't seem that it's possible to disable
# the context menu in recent versions of Chrome. If this
# is resolved, please also adjust the docstring in MouseEvent.
ifbutton==2:
button=3

I don't think I entirely understand the issue described by that comment but I'd argue that it is better to allow users to make the choice to listen for middle clicks rather than to report middle click as right click. Also there does not seem be anything in MouseEvent docstring about this:https://matplotlib.org/3.3.0/api/backend_bases_api.html#matplotlib.backend_bases.MouseEvent

I ran into this when using the ipympl backend (xrefmatplotlib/ipympl#254)
Code for reproduction

In the notebook:

importipywidgetsaswidgetimportmatplotlib.pyplotasplt%matplotlibwidgetout=widgets.Output()@out.capture()defcallback(event):print(event.button)plt.ioff();fig,ax=plt.subplots();plt.ion()fig.canvas.mpl_connect('button_press_event',callback)fs=15ax.text(0.1,0.1,'left click here',fontsize=fs)ax.text(0.5,0.5,'middle click here',fontsize=fs)ax.text(0.7,0.8,'right click here',fontsize=fs)widgets.HBox([out,fig.canvas])

Actual outcome

jupyter

Expected outcome
in ipython it gives this
ipython

Matplotlib version

  • Operating system: Ubuntu 20.04
  • Matplotlib version: 3.30
  • Matplotlib backend (print(matplotlib.get_backend())): 'module://ipympl.backend_nbagg'
  • Python version: 3.8.5
  • Jupyter version (if applicable): jupyterlab 2.2.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp