O'Reilly logo

Python Multimedia Beginner's Guide by Ninad Sathaye

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action - raindrops animation

Let's create an animation of falling raindrops by using different regions of a single image.

  1. Download the Python source file RainDropsAnimation.py and the image file droplet.png from the Packt website. As done before, place the image file in a sub-directory images. The images directory should be placed in the directory in which the Python source file is located.
  2. The __init__ method of the class RainDropsAnimation is presented.
    1 def __init__(self, width=None, height=None):
    2 pyglet.window.Window.__init__(self,
    3 width=width,
    4 height=height)
    5 self.drawableObjects = []
    6 self.createDrawableObjects()
    
  3. The code is self-explanatory. The class RainDropsAnimation inherits pyglet.window.Window. The constructor of the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required