Title: Importing pyplot steals focus on macOS · Issue #12724 · matplotlib/matplotlib · GitHub
Open Graph Title: Importing pyplot steals focus on macOS · Issue #12724 · matplotlib/matplotlib
X Title: Importing pyplot steals focus on macOS · Issue #12724 · matplotlib/matplotlib
Description: Bug report Bug summary I really don't know if this is a but with the conda python.app package or with matplotlib. When you run python.app/pythonw on Mac OS X and import pyplot, it launches the python.app app to the foreground, which stea...
Open Graph Description: Bug report Bug summary I really don't know if this is a but with the conda python.app package or with matplotlib. When you run python.app/pythonw on Mac OS X and import pyplot, it launches the pyth...
X Description: Bug report Bug summary I really don't know if this is a but with the conda python.app package or with matplotlib. When you run python.app/pythonw on Mac OS X and import pyplot, it launches the ...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/12724
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Importing pyplot steals focus on macOS ","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\nI really don't know if this is a but with the conda python.app package or with matplotlib. \r\n\r\nWhen you run `python.app`/`pythonw` on Mac OS X and import pyplot, it launches the python.app app to the foreground, which steals the keyboard focus from the terminal. You can also reproduce this in IPython, which uses python.app (at least the conda version does).\r\n\r\nObviously I want any `plot` calls to call the plot to the foreground, but that it does this simply by importing pyplot is quite annoying (for instance, it often does it when I am running some tests). \r\n\r\nWeirdly, I tried debugging the import with pudb, and it seems the app gets launched when the `close` function is defined https://github.com/matplotlib/matplotlib/blob/531bd02409ba5efd75ec13f713f6faf6974199d4/lib/matplotlib/pyplot.py#L623. That doesn't make any sense to me, but it does it consistently. \r\n\r\nAlso weirdly, when I tried to reproduce the bug with the git version, it didn't reproduce, even when I used the v3.0.0 version tag. My only guess is that somehow things compiled differently for me than they did for the conda package. \r\n\r\n\u003c!--A short 1-2 sentences that succinctly describes the bug--\u003e\r\n\r\n**Code for reproduction**\r\n\r\nOn macOS, run\r\n\r\n```\r\npythonw\r\n```\r\n\r\nthen run\r\n\r\n```py\r\nimport matplotlib.pyplot\r\n```\r\n\r\n\u003c!--A minimum code snippet required to reproduce the bug, also minimizing the number of dependencies required--\u003e\r\n\r\n**Actual outcome**\r\n\r\n\u003c!--The output produced by the above code, which may be a screenshot, console output, etc.--\u003e\r\n\r\nThe `python.app` launches and steals the keyboard focus.\r\n\r\n**Expected outcome**\r\n\r\nEither the app doesn't launch until a `plot` or `show` call is made, or it launches in the background (but an actual `show` call should launch it to the foreground and steal focus). \r\n\r\n\u003c!--A description of the expected outcome from the code snippet--\u003e\r\n\u003c!--If this used to work in an earlier version of Matplotlib, please note the version it used to work on--\u003e\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: macOS 10.12.6 (I also reproduced on Mojave)\r\n * Matplotlib version: 3.0.0 (conda-forge)\r\n * Matplotlib backend (`print(matplotlib.get_backend())`): Qt5Agg\r\n * Python version: 3.5\r\n * Jupyter version (if applicable):\r\n * Other libraries: \r\n\r\nThe conda-forge `python.app`.\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/asmeurer","@type":"Person","name":"asmeurer"},"datePublished":"2018-11-02T23:59:56.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/12724/matplotlib/issues/12724"}
| 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:273259de-fa46-8626-59e8-57df3bf5318b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AEA6:2BA6B2:3C2B8D6:5541628:6A56C9D3 |
| html-safe-nonce | 4aab36a3f0ff3a1b8de3d4dcaed23e353fe1b75612ccb90356b4a3f8bd71e21b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRUE2OjJCQTZCMjozQzJCOEQ2OjU1NDE2Mjg6NkE1NkM5RDMiLCJ2aXNpdG9yX2lkIjoiODQyNzkwNTQwNjM1NDI0NjA5OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | fd58d9794059c8efd11ded6262f054846fdd0193a203bb188fca00cb1aa1e852 |
| hovercard-subject-tag | issue:377002080 |
| 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/12724/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ab6c708b23fff10edbac18453d2c8bb643c8664f8e9703bf98c202b4868dbf2f/matplotlib/matplotlib/issues/12724 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ab6c708b23fff10edbac18453d2c8bb643c8664f8e9703bf98c202b4868dbf2f/matplotlib/matplotlib/issues/12724 |
| og:image:alt | Bug report Bug summary I really don't know if this is a but with the conda python.app package or with matplotlib. When you run python.app/pythonw on Mac OS X and import pyplot, it launches the pyth... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | asmeurer |
| hostname | github.com |
| expected-hostname | github.com |
| None | df99b7164e1d961b639cf5d3cbd6b5ba673edc67bd7e47cdc4746b96099e11ae |
| 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 | 3146ab55fc8763ab0e1d2a875e600b3a545bc751 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width