On Sunday, January 29, 2012, Jerzy Karczmarczuk <
jerzy.karczmarc...@unicaen.fr> wrote:
> I believe that I should terminate this thread (from my side), since the
image is clear. The actual version of Matplotlib is not adapted to my
needs, a rather involved animation of many objects, and changing. The last
dialogue with Benjamin Root, whom I am deeply grateful, cleared my doubts.
Ben confirms that I am on my own:
>
>> // you need to create your web of callbacks accordingly. The callback
registry is just simply a tool that we created for our use. Keep in mind
that your original question to this thread was "how do I fire events?". I
answered that question a while back.
>
> My question - sorry for being unclear - was how to fire events
ASYNCHRONOUSLY. How to post them, to be processed by the event loop, not
how to call callbacks.
>
>> Ok, but the callback registry is not an event loop. It is just a
callback registry. The main-loops are in the respective GUI toolkits.
>
> I know that. I read a good part of the matlotlib source, but not all of
this, since I thought that asking questions might be more efficient. And
actually it was.
>
>> There is no event queue in the CallbackRegistry. What we have done in
the respective GUI backends is to link various GUI actions to calls to
process(). The CallbackRegistry itself is GUI-neutral and heck, it doesn't
even assume a GUI exists, which allows for us to still use the callback
registry for other uses in non-interactive modes and headless modes.
Therefore, there is no mainloop, there is no event queue.
>
> This, I believe, is the final answer. Sigh. OK. I am not saved from the
Pooh syndrome (The more he looked inside the more Piglet wasn't there),
since now I plan to either code something myself, or to give it as a
project to my students. I believe that Matplotlib merits this, there is
plenty of potentialities, but the animation seems to be still in statu
nascendi.
>
>> I also noticed that in the example you posted, you created your own
callback registry. Why didn't you use the existing one that comes with the
figure canvas?
>>
> Oh, of course. But this was accidental, it doesn't change anything.
>
>> Quite honestly, I (and I suspect others) are not sure what you are
asking of us. You seem to be quite knowledgeable, but -- quite frankly --
all I see is you complaining about the problem. /.../ I need you to be
very clear about what you want and to exclude any extraneous "rants" you
may have.
>
> NO SIR. I am not complaining (cite my "complaints" if you disagree). I am
trying to find a solution to a problem of delayed, asynchronous event
processing within Matplotlib. I try to be compact, this is just a mailing
list. And please: what "rants"??? I would never say anything bad about the
system nor its authors, I am asking questions. No bugs to reports (only
that from time to time Python declares some execution error of a
sub-process, but it may have several sources).
>
>> My only guess is that you were hoping that there was a GUI-neutral
mainloop in mpl. I am sorry to say that one doesn't exist in the manner
you are speaking.
>
> Again, this IS the answer. Thank you very much.
>
> ================
>
> There is one "rant", if you wish (of course, I am joking).
>
> The animation objects (FuncAnimation, etc.) are coded as they are,
probably sufficient for you. They are "one shot". But if you want to stop
and to resume your animation, they are not so well adapted. Calling ._stop
(not documented) from a callback is deadly, because of the cleaning
procedures. You can't re-_start it. The only way - as I see it - is to
create another animation. OK, but this might not be the most efficient way
to do it.
>
> I am afraid that my fascination by Matplotlib, which I really use for my
teaching of scientific programming and visualization, pushed me to try to
use the package outside its actual limits. Sorry bor bothering you. If I
find something of general interest, I will post it, perhaps.
>
> All the best, sincerely.
>
> Jerzy Karczmarczuk
> Caen, France
>
>
No problem, I am glad to see the question cleared up. I suspect that what I
interpreated as a rant was more related to my frustrations, so I apologize.
I wonder if the Timer class in cbook.py might be useful to you? It is
GUI-neutral and it could act as a global "heartbeat" for your simulator.
As for your issues with the animation class. It is a very new feature and
we welcome any feedback. The _stop() function is intended, iirc, to be
used for when the figure window closes. What you are looking for is some
sort of pause() function. Feel free to file a feature request on mpl's
github page.
Cheers!
Ben Root
------------------------------------------------------------------------------
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