On Sun, Nov 21, 2010 at 10:36 AM, Pierre Raybaut
<pierre.rayb...@gmail.com> wrote:
> Hi all,
>
> Following a discussion with a Spyder user regarding simple animations
> with Matplotlib, I took a very quick look at the Qt4's backend source
> code to see if it was possible to make the following code work (which
> is working with the TkAgg backend but not the Qt4 backend):
> http://www.scipy.org/Cookbook/Matplotlib/Animations#head-e50abcca4333d3d76b3f2bb66ef00f15c6b4dbbc
>
> Apparently, to make it work with the Qt4 backend, one simply has to add:
> QtGui.QApplication.processEvents()
> to the method 'FigureCanvasQt.draw_idle' (matplotlib/backends/backend_qt4.py).
>
> I did not look further to see if this QApplication.processEvents call
> is affecting Matplotlib's performance in any way, but I guess that it
> won't make a big difference.

>From 
>http://www.mail-archive.com/matplotlib-de...@lists.sourceforge.net/msg05606.html
, discussion of why processEvents was originally removed from draw():

"that line can not be added back in. When that line
is in place, the backend attempts to process queued events before it
is finished processing the current event. It was leading to segfaults
in some cases. processEvents should not be called in the middle of
processing an event."

I am not familiar with draw_idle, and the documentation isn't helpful.
Adding processEvents to that call looks similar to adding it to the
end of the draw method itself. I'll argue strongly against such a
change until it can be shown that the call to processEvents will never
occur while processing a current event (I don't want to reintroduce
segfaults in the programs I use at work.)

Darren

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to