From: Tony Yu <ts...@gm...> - 2012-01-13 23:35:51
|
On Fri, Jan 13, 2012 at 6:32 PM, Gellule Xg <gel...@fr...> wrote: > On 1/13/12 12:53 , Tony Yu wrote: > >> >> On Thu, Jan 12, 2012 at 1:37 PM, Gellule Xg <gel...@fr... >> <mailto:gel...@fr...>> wrote: >> >> If you are a macosx backend user, you are welcomed to test the >> following >> branch: https://github.com/gellule/**matplotlib<https://github.com/gellule/matplotlib>. >> With the branch, when >> issuing a pylab.show() in non-interactive mode, the plot windows should >> appear in the foreground with focus, instead of appearing in the >> background. It should make things a little easier for you. >> >> >> This works as advertised on my system (plot window grabs focus when >> running scripts in MacVim, Terminal, and IPython when in non-interactive >> mode). Unfortunately, I tend to use the QT4Agg backend, which also >> leaves plot windows in the background. Maybe I'd switch to the macosx >> backend with this addition. >> > > Thanks! > > I am also curious to know what people think of making pylab.show() also >> yield the focus to the plot windows in -interactive- mode? All the >> other >> commands update the plot windows automatically, keeping the focus in >> the >> python interpreter. So pylab.show() would only do that: yield the focus >> to the plot windows. That is not in the branch (yet). >> >> >> I'd lean toward no: the plot window shouldn't grab focus in interactive >> mode. I have some scripts that take command-line input in-between plot >> calls. If the plot window grabbed focus, then I'd have to switch focus >> back to enter input. This probably isn't a common use case, though. >> > > But you don't use show() in interactive mode, do you? The focus grab would > not happen until you call show(). > > I other words, show() would always send the focus to the plot windows. But > depending on how interactive is set, it would block or not. If you are in > interactive mode and don't want to send the focus to the plot windows, you > would have to not call show(). > > -Julien > Good point: my scripts call draw(), instead of show(). Ignore what I said earlier. :) -Tony |