anim.py questions

I have a couple questions about anim.py:
http://matplotlib.sourceforge.net/examples/anim.py

I'm running Python 2.5.1 and Matplotlib 0.90.1 under Win 2000.

1. Running anim.py at DOS prompt: it runs correctly until
the end:

    Fatal Python error: PyEval_RestoreThread: NULL tstate

    This application has requested the Runtime to terminate it in an unusual way.
    Please contact the application's support team for more information.

How can I get rid of this error?

2. Running under the Python interpreter (using execfile):

The Tk window will not display until the script has finished
running, so the animation cannot be viewed. How can I run
this animation from the interpreter window?

Thank you,
Alan Isaac

OK, there is a simple fix to this:
explicitly close the figure after the loop.
I'll attach a fixed example file, in case
a developer cares to substitute it.

New question 1: why is this necessary?

New question 2: why can I tab away from the Tk Window
while this script is running but not tab back to it?

Old question remaining:

Running under the Python interpreter (using execfile): The
Tk window will not display until the script has finished
running, so the animation cannot be viewed. How can I run
this animation from the interpreter window?

Note that this seems closely related to New Question 2.

Thank you,
Alan Isaac

anim.py (949 Bytes)

···

On Sat, 12 Apr 2008, Alan G Isaac apparently wrote:

1. Running anim.py at DOS prompt: it runs correctly until
the end:
    Fatal Python error: PyEval_RestoreThread: NULL tstate