|
From: Gael V. <gae...@no...> - 2006-10-30 19:59:57
|
On Mon, Oct 30, 2006 at 12:37:42PM -0700, Fernando Perez wrote:
> Jut to clarify, Gael: in ipython (with -pylab or -{g,w,q}thread), what
> happens is that IPython lets the GUI toolkit run in the main thread,
> and then attaches its own routines for user code execution as the
> toolkit's idle timer callback and runs in a secondary thread (each
> toolkit has its own way of doing this, but the basic idea is the
> same).
OK, similar to launching a wx application and starting a thread in it
with ipython attached to this thread ? Is there a "hook" to the main
eventloop that would be accessible to the code running in ipython. Thus
a wx.CallAfter or alike in different toolkits, and other eventloop and
multi-threaded programming tricks might be useful here. Maybe this
solution would even provide the solution for blocking calls with MPL
with most multi-threaded cases.
The problem I hit in my first attempt was that the "connect" call
executed in my function did not seem to be executed until the function
returned. If I can connect a callback to the figure in the beginning of
the function, then loop waiting and checking a parameter the will be set
be the callback, then process the parameter when available.
I do not see why this could not work, but then my understanding of
multithreaded programming is quite poor.
> This two-thread arrangement has a big drawback: the inability to
> interrupt long-running calculations (even non-blocking ones) with
> Ctrl-C, because it is simply impossible in Python to toss asynchronous
> signals accross threads.=20
Yes :-<. Have you tried getting some help from a guru, it seems to be
worth the while.
Cheers,
Ga=C3l
|