简体   繁体   中英

Matplotlib Figure inside Python Launcher, MacOSX

I recently got a new mac and reinstalled Python 2.7.5 and NumPy, Matplotlib, etc. inside a virtualenv. Everything works so far but I trouble with matplotlib windows. Here is a before/after explanation of the problem:

Before: On my old mac, when I would use matplotlib to plot, there would be a window created and opened with "Python Launcher" after calling plt.show(). Ie this window would be treated by OSX as a normal application running. Therefore it would have its own dock icon from the python Launcher, an own menu-bar, where the app would be simply called "Python" etc.

After: Now, on my new machine, when I do the same, there is a figure window created, but, it is not treated by MacOSX as an application. This creates some problems: - When the window is created it doesn't get focus, ie it is opened behind all other windows. - When I want to switch to the window (eg with Mission Control), this won't work and the window will show up for a blink of the second and the be behind all other windows again. - I can't close the window with cmd+q etc. All I can do is move all other windows out of the way to see the plot.

Is this the normal matplolib behaviour or did something get screwed up during installation?
On my old mac, I installed Python with MacPorts, now I used the official Python installers from python.org.

Any Ideas? Thanks Jan

I'm tackling a similar issue, except I'm just setting up a new virtualenv on the same machine. One virtual environment gets a dock icon for each python instance, the other (newer) virtual environment doesn't. Both use system framework python.

It took a while to remember, but the gist of my scenario is that using virtualenv lost the "Framework" nature of my python build. But I rediscovered this StackOverflow question that I had originally used to find the info. I used this software to get a mini Python.app in my new virtual env that restores Framework-like behavior ie the ability to interact with the OS and create a dock icon (lots of good framework info in this question )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM