Title: Double-click events are not recognised in Jupyter notebook · Issue #18404 · matplotlib/matplotlib · GitHub
Open Graph Title: Double-click events are not recognised in Jupyter notebook · Issue #18404 · matplotlib/matplotlib
X Title: Double-click events are not recognised in Jupyter notebook · Issue #18404 · matplotlib/matplotlib
Description: Bug report Bug summary Using the first example from the events documentation detects double-click events properly in the Qt backend, but when used in a Jupyter notebook, the two clicks are recognised as two separate single click events. ...
Open Graph Description: Bug report Bug summary Using the first example from the events documentation detects double-click events properly in the Qt backend, but when used in a Jupyter notebook, the two clicks are recognis...
X Description: Bug report Bug summary Using the first example from the events documentation detects double-click events properly in the Qt backend, but when used in a Jupyter notebook, the two clicks are recognis...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/18404
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Double-click events are not recognised in Jupyter notebook","articleBody":"\u003c!--To help us understand and resolve your issue, please fill out the form to the best of your ability.--\u003e\r\n\u003c!--You can feel free to delete the sections that do not apply.--\u003e\r\n\r\n### Bug report\r\n\r\n**Bug summary**\r\n\r\nUsing the first example from the [events documentation](https://matplotlib.org/3.3.1/users/event_handling.html) detects double-click events properly in the Qt backend, but when used in a Jupyter notebook, the two clicks are recognised as two separate single click events.\r\n\r\n**Code for reproduction**\r\n\r\nI've adapted the code to show the contents of the `event` as the figure title instead of a `print` statement, because the output of `print` statements inside functions triggered by events disappear in Jupyter notebooks.\r\n\r\n```python\r\nimport matplotlib.pyplot as plt\r\nimport numpy as np\r\nfig, ax = plt.subplots()\r\nax.plot(np.random.rand(10))\r\n\r\ndef onclick(event):\r\n ax.set_title('%s click: button=%d, x=%d, y=%d, xdata=%f, ydata=%f' %\r\n ('double' if event.dblclick else 'single', event.button,\r\n event.x, event.y, event.xdata, event.ydata))\r\n\r\ncid = fig.canvas.mpl_connect('button_press_event', onclick)\r\n```\r\n\r\n**Actual outcome**\r\n\r\nThe title always says `single-click`, no matter how fast I do my double-clicking.\r\n\r\n\r\n\r\nThe double click events are properly captured when using the standard Qt window renderer.\r\nI have tried both the default `%matplotlib notebook` backend and the `ipympl` widget backend, and they show identical behaviour.\r\n\r\n**Matplotlib version**\r\n\u003c!--Please specify your platform and versions of the relevant libraries you are using:--\u003e\r\n * Operating system: Ubuntu 20.04\r\n * Matplotlib version: 3.2.2\r\n * Matplotlib backend (`print(matplotlib.get_backend())`): nbAgg, ipympl\r\n * Python version: 3.7.6\r\n * Jupyter version (if applicable): jupyter_client=6.1.6, jupyter_core=4.6.3, notebook=6.0.3\r\n * Other libraries: \r\n\r\n\u003c!--Please tell us how you installed matplotlib and python e.g., from source, pip, conda--\u003e\r\n\u003c!--If you installed from conda, please specify which channel you used if not the default--\u003e\r\nInstalled in a `conda` env from `conda-forge`.\r\n","author":{"url":"https://github.com/nvaytet","@type":"Person","name":"nvaytet"},"datePublished":"2020-09-04T06:09:22.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/18404/matplotlib/issues/18404"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:0bae74ce-659a-25ad-47b1-46737805e1c4 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9DE0:4342D:F08F10:140EB48:6A529059 |
| html-safe-nonce | 2e21c9a49693ed1b355f1f0be6fd829aedbd390770e02483b58df81f1d1772ff |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5REUwOjQzNDJEOkYwOEYxMDoxNDBFQjQ4OjZBNTI5MDU5IiwidmlzaXRvcl9pZCI6IjM3MjQyODg3ODE1MTU4NTg4MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 36925d7faa1ba28cd7da4c8661757097e6e21088171192f65245aa709d74a778 |
| hovercard-subject-tag | issue:692764744 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/matplotlib/matplotlib/18404/issue_layout |
| twitter:image | https://opengraph.githubassets.com/67f7d764014a1b6d4e85d43cfc834460f6518a984846dcd0f3b33e2e156ae82a/matplotlib/matplotlib/issues/18404 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/67f7d764014a1b6d4e85d43cfc834460f6518a984846dcd0f3b33e2e156ae82a/matplotlib/matplotlib/issues/18404 |
| og:image:alt | Bug report Bug summary Using the first example from the events documentation detects double-click events properly in the Qt backend, but when used in a Jupyter notebook, the two clicks are recognis... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | nvaytet |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| go-import | github.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git |
| octolytics-dimension-user_id | 215947 |
| octolytics-dimension-user_login | matplotlib |
| octolytics-dimension-repository_id | 1385122 |
| octolytics-dimension-repository_nwo | matplotlib/matplotlib |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1385122 |
| octolytics-dimension-repository_network_root_nwo | matplotlib/matplotlib |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width