John Hunter wrote:
>> Wriing a GUI neutal idle event handler is not easy -- I've spent some
>> time on it but crashed and burned on tk

 >  I think
> it would be great if we could abstract the idle handler and timeout
> handler across the GUIs so that mpl animation would be easier, but to
> date this has eluded me.

Maybe getting away from the Idle event approach would be the way to go. 
I've done a lot of (non-MPL) wx work, including animations, and NEVER 
found a use for the idle event. For animation work in wx, using a 
wx.Timer, and often a call to wx.Yield seems to generally be the way to 
go. Perhaps this same approach could be done on the other back ends as well.

As for idle events, I've found them to be useless because you get lots 
of them when you don't need it, and may not get them when you do. In wx 
at least, an Idle event is triggered when the event loop _becomes_ 
empty. That means that when the user is moving the mouse and there is no 
mouse_move event handler, you get this huge string of idle events. 
However, if the user is doing nothing for a bit, you get one event, then 
nothing until the user does something again.

I can see the appeal of an Idle event -- there are all sorts of things 
you might want to do when the app is "idle", but the reality is that 
what you really want to know is when the app is _going to be_ idle for a 
bit, and there is no way to know that (at least not without Guido's time 
machine, anyway...).

I've lost track of what problems you're trying to solve with idle 
events, but maybe an abstraction of a timer system would be a more 
robust approach, for animations, anyway.

-Chris






-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

chris.bar...@noaa.gov

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to