Python: Animation with PIL

animation, python, python-imaging-library

Solution

PIL is geared towards image editing, not animating or displaying. Instead, look to a GUI toolkit or a multimedia library like pyglet or pygame

Problem

I want an animated picture. But I need a refresh-function because plt.show() always opens a new window. Does anybody have a hint? Thanks! ``` import numpy as np import scipy from scipy import * import matplotlib.pyplot as plt #array aa = [] for x in range(44): aa.append([]) for z in range(44): aa[x].append(3*sin(x/3.0)+2*cos(z/3.0)) b = aa plt.imshow(b) plt.show() time = 0 dt = 0.1 while(time<3): b = sin(aa) time += dt ```

Original source