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

Importing pyplot steals focus on macOS #12724

Closed
@asmeurer

Description

@asmeurer

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 runpython.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).

Obviously I want anyplot 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).

Weirdly, I tried debugging the import with pudb, and it seems the app gets launched when theclose function is defined

defclose(fig=None):
. That doesn't make any sense to me, but it does it consistently.

Also 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.

Code for reproduction

On macOS, run

pythonw

then run

importmatplotlib.pyplot

Actual outcome

Thepython.app launches and steals the keyboard focus.

Expected outcome

Either the app doesn't launch until aplot orshow call is made, or it launches in the background (but an actualshow call should launch it to the foreground and steal focus).

Matplotlib version

  • Operating system: macOS 10.12.6 (I also reproduced on Mojave)
  • Matplotlib version: 3.0.0 (conda-forge)
  • Matplotlib backend (print(matplotlib.get_backend())): Qt5Agg
  • Python version: 3.5
  • Jupyter version (if applicable):
  • Other libraries:

The conda-forgepython.app.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp