Tony Yu suggests that my multiple and changing animation problems could 
be solved using coroutining.
> have you looked into using a coroutine. /... /I've attached a simple 
> example below.
>
> import matplotlib.pyplot as plt
> import numpy as np
> def datalistener():
> ...
>     while True:
>         y0 = yield
>         x = np.hstack((line.get_xdata(), i))
>   ...
> plt.ion()
> ...
Thank you Tony. No, unfortunately this is again a "side solution". Of 
course, coroutines, or just a simple event loop using Python generators 
without .send(), are perfectly decent tools to simulate parallel 
"movements". But, coroutines as such, are better adapted to situations 
where the actors transfer the control among themselves, where there is a 
network of direct communications, a "multi-ping-pong".
In my case this is redundant, my "planets" which move concurrently are 
independent, and they, after having updated their properties, need only 
to yield the control to the interface, to draw them. The interface 
resumes (by calling, no .send() is needed) all the actors in sequence. I 
repeat again : I COULD have written my own event loop (under ion()).

But I don't want to do this, since show() which calls some lower level 
mainloop() does all this already!

In particular, it handles the physical events, all mousing, which need 
anyway some lower-level mechanisms, and my own coroutines won't help. I 
MUST use the built-in tools in order to handle the mouse.

So, I repeat, my only [as I see it] rational choice is to plug-in my 
events into the standard loop. Under, say, plain wxPython, I can write 
my own, and call ProcessPendingEvents(), but with Matplotlib, no idea.
Ben Root  suggested to look some existing codes, say the Picker. But 
this is called upon a physical event, which is "fired" under the hood. 
My events are "virtual", I have to post them myself from a callback, so 
it canot call recursively another callback, or I am dead.

Best regards.

Jerzy


------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to