4

I'm not sure exactly what is going on under the hood, but here is my setup, example code, and problem:

setup:

  • snow leopard (10.6.8)
  • Python 2.7.2 (provide by EPD 7.1-2)
  • iPython 0.11 (provided by EPD 7.1-2)
  • matplotlib (provided by EPD 7.1-2)

example code:

import numpy as np
import pylab as pl
x=np.random.normal(size=(1000,))
pl.plot(x)

problem:

I can't use the standard Mac OS X shorcuts to access the window generated by the plot command.

For example, I can't Command-Tab to the window. Thus, if the window is behind some other window, I need to mouse over to it! Command-W doesn't close it.

Obviously, this is unacceptable. It seems like perhaps running Lion instead of Leopard might fix this, but i haven't upgraded yet. I feel like the problem has something to do with iPython generating windows that aren't fully Cocoa-aware in some sense, but I really know very little so I'm not particularly confident in this hypothesis.

Thus, any ideas on how to either resolve or get around this issue would be much appreciated.

Rob Keniger
  • 45,830
  • 6
  • 101
  • 134
jovo
  • 41
  • 1
  • Hi @jovo. Did you ever solve this on Snow Leopard/Lion? I saw the desired behavior (I could Command-Tab to my plot window) when on Snow Leopard but a new computer with a clean slate has produced your problem. – physicsmichael Jan 26 '12 at 04:16
  • I agree that this is extremely annoying, and I'm also looking for a solution, myself, but one workaround is using Expose--the windows do show up there – acjay Jul 12 '12 at 04:47

2 Answers2

2

From the description on the iPython page, it looks like Python uses Qt to generate UI. This means that the windows it generates are definitely not Cocoa windows and will not act like them.

There's not likely to be an easy solution to this issue.

Rob Keniger
  • 45,830
  • 6
  • 101
  • 134
  • thank you, that is an incredibly helpful response. perhaps a different IDE (such as spyder: http://code.google.com/p/spyderlib/) will solve my problems. – jovo Aug 29 '11 at 10:25
  • I think your best bet is to use [PyObjC](http://developer.apple.com/cocoa/pyobjc.html) to create a Cocoa application using Python. You will then be generating an actual Cocoa app. – Rob Keniger Aug 29 '11 at 10:43
0

I experienced the same annoyance with my Anaconda installation of Python 2.7.10 on Mac OS X Yosemite 10.10.5. One solution I found was to change the backend to Mac OS X or Qt4Agg by creating a ~/.matplotlib/matplotlibrc file with the line:

backend: MacOSX

or

backend: Qt4Agg

Now I can easily get to the plot window with Application switcher using Command - Tab and close it with Command - W .

user3148185
  • 512
  • 3
  • 8