Building an animation using Python Gizeh
Question: I am able to create a simple diagram with shapes and numbers. I am using the
following code:

    
    
    import gizeh as gz
    
    W, H = 500, 300
    
    surface = gz.Surface(W,H, bg_color=(1,0.7,1))
    
    for a in range(1,9):
        rect = gz.rectangle(lx = 10, ly = 10, xy=(W/a,H/a), fill =(0,1,0.7))
        rect.draw(surface)
        txt = gz.text(str(a), fontfamily="Dancing Script", fontsize=15, fill=(0,0,0),xy=(W/a,H/a))
        txt.draw(surface)
    
    surface.ipython_display()
    

I have also created a version using moviepy:

    
    
    import numpy as np
    import gizeh as gz
    import moviepy.editor as mpy
    
    W, H = 500, 300
    duration = 5
    figpath = '/tmp/'
    fps = 1
    
    def make_frame(t):
    
        surface = gz.Surface(W,H, bg_color=(1,1,1))
    
        rect = gz.rectangle(lx = 10, ly = 10, xy=(W/(t+1),H/2), fill =(0,1,0.7))
        rect.draw(surface)
        txt = gz.text(str(t+1), fontfamily="Dancing Script", fontsize=15, fill=(0,0,0),xy=(W/(t+1),H/2))
        txt.draw(surface)
    
        return surface.get_npimage()
    
    clip = mpy.VideoClip(make_frame, duration=duration)
    clip.write_videofile(figpath + 'trax_0.mp4', fps=fps)
    
    clip.ipython_display(fps=fps, width=W, autoplay=0, loop=0)
    

I would like to be able to create animated GIF using a time delay between each
step of the cycle.


Answer: Try to use MoviePy - a module from the author of Gizeh.  
Look at a good article where Gizeh and MoviePy are used for the animation:
<http://zulko.github.io/blog/2014/09/20/vector-animations-with-python/>

