Title: figure_enter_event generates base Event and not LocationEvent · Issue #9812 · matplotlib/matplotlib · GitHub
Open Graph Title: figure_enter_event generates base Event and not LocationEvent · Issue #9812 · matplotlib/matplotlib
X Title: figure_enter_event generates base Event and not LocationEvent · Issue #9812 · matplotlib/matplotlib
Description: Bug report Bug summary In the documentation [1] it says that "figure_enter_event" generates a LocationEvent. However in the source code it just generates the base class Event. Further investigation showed that some backends do not pass t...
Open Graph Description: Bug report Bug summary In the documentation [1] it says that "figure_enter_event" generates a LocationEvent. However in the source code it just generates the base class Event. Further investigation...
X Description: Bug report Bug summary In the documentation [1] it says that "figure_enter_event" generates a LocationEvent. However in the source code it just generates the base class Event. Further inv...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/9812
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"figure_enter_event generates base Event and not LocationEvent","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\nIn the documentation [1] it says that \"figure_enter_event\" generates a LocationEvent. However in the source code it just generates the base class Event. \r\n\r\nFurther investigation showed that some backends do not pass their coordinates when entering the figure. The tkagg backend (default) does not have figure_enter_event nor figure_leave_event.\r\n\r\n```\r\ngrep \"FigureCanvasBase.enter_notify_event\" *py\r\nbackend_gtk3.py: FigureCanvasBase.enter_notify_event(self, event)\r\nbackend_gtk.py: FigureCanvasBase.enter_notify_event(self, event, xy=(x, y))\r\nbackend_qt5.py: FigureCanvasBase.enter_notify_event(self, guiEvent=event)\r\nbackend_wx.py: FigureCanvasBase.enter_notify_event(self, guiEvent=evt)\r\n```\r\n\r\n\r\n[1] : https://matplotlib.org/users/event_handling.html\r\n**Code for reproduction**\r\n\r\n\r\n```python\r\nimport matplotlib\r\n\r\nmatplotlib.use(\"Qt5Agg\") #may omit\r\nimport matplotlib.pyplot as plt\r\nimport numpy as np\r\n\r\nx = range(100)\r\n\r\nfig, ax = plt.subplots()\r\nax.plot(np.random.rand(10))\r\n\r\n\r\ndef stat(event):\r\n print(\"axes: {}, x: {}, y: {}\".format(event.inaxes, event.x, event.y))\r\n\r\n\r\ncid = fig.canvas.mpl_connect('figure_enter_event', stat)\r\ncid = fig.canvas.mpl_connect('figure_leave_event', stat)\r\n\r\nplt.show()\r\n\r\n```\r\n\r\n**Actual outcome**\r\nMissing LocationEvent attributes.\r\n\r\n```\r\n\r\n```\r\n\r\n**Expected outcome**\r\n\r\nExpect LocationEvent attributes and the documentation to be consistent\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: \r\n * Matplotlib version: 2.1.0, 2.0.2\r\n * Matplotlib backend (`print(matplotlib.get_backend())`):\r\n * Python version: 3.5\r\n * Jupyter version (if applicable):\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\n\r\n","author":{"url":"https://github.com/lkjell","@type":"Person","name":"lkjell"},"datePublished":"2017-11-19T02:29:17.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/9812/matplotlib/issues/9812"}
| 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:3225f898-dfe9-d246-5a6c-332360a08b8a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9608:153FD3:29C9592:38F6FBB:6A53B985 |
| html-safe-nonce | 8a34ac95bb80acdb8046fa90ea14898c21062ac8d514f0a36a0bc715ca82f9b8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NjA4OjE1M0ZEMzoyOUM5NTkyOjM4RjZGQkI6NkE1M0I5ODUiLCJ2aXNpdG9yX2lkIjoiMTIwOTUwNzI2MTMwMzgzMjM3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 7d261907d7db02c16a4773d833a4ab21192b8aa7cabf1386228726a4af828e2c |
| hovercard-subject-tag | issue:275126543 |
| 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/9812/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a98299d866d5c74484855bf6500af57bd56361c38a9b318b1f72f66816372444/matplotlib/matplotlib/issues/9812 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a98299d866d5c74484855bf6500af57bd56361c38a9b318b1f72f66816372444/matplotlib/matplotlib/issues/9812 |
| og:image:alt | Bug report Bug summary In the documentation [1] it says that "figure_enter_event" generates a LocationEvent. However in the source code it just generates the base class Event. Further investigation... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | lkjell |
| 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