Menu

Interactive console blocks on plot

dbarro
2010-08-10
2013-03-15
  • dbarro

    dbarro - 2010-08-10

    Is it possible (by configuration or changing some setting) to not have the interactive console block on plot? Currently, if there is a plot command and then some code following it, the interactive console waits until the plot window is closed. In spyder (as part of python x,y) the interactive console does not block on plot. It is useful if one wants to keep the plot window on while investigating the data in the interactive console.

    Thanks!

     
  • dbarro

    dbarro - 2010-08-11

    I was able to use nonblocking calls in matplotlib so the computation now continues after a plot command. However, anything I print is held up until the plot is displayed and closed (even if the plot code is well after the print statements, and stdout.flush doesn't help).  Is it possible to force flush the output to the interactive console? Thanks.

     
  • Fabio Zadrozny

    Fabio Zadrozny - 2010-08-11

    Hi,

    Well, for the first post, yes, you can only do non-blocking calls (this would be the same in the default python shell and there's no real workaround, as the console is in the main thread and GUI toolkits usually only work in the main thread too).

    As for the print, not sure about what's being done exactly in your case, what I do know is if a command returns to the prompt initially, pydev will show that, but it will not print to the output asynchronously, so, only after a new command is issued (even if it's just an empty line) will the output show.

    Cheers,

    Fabio

     
  • dbarro

    dbarro - 2010-08-11

    ok, I understand it a bit more, I think. I was running the script with Ctrl-Alt-Enter which means that it would be one command (one execfile). So, it seems that if the script has a few prints and then a plot show() then the show() causes the execfile() command to wait and only when the plot window is closed, show() exits and so does execfile(), then causing stdout to show up in the console.

    If I run via the Ctrl-F11 key then since it is not execfile, the print output appears as and when those statements are executed. But, Ctrl-F11 starts a new console every time.  :(

    Anyway, I also learnt that Ipython (and hence spyder) supports nonblocking calls much better. I know lots of people have mentioned it and it seems like there are technical issues, but it would be great to be able to use ipython from eclipse.