It's time to write the code for this animation.
Download the Python source file
RainyDayAnimation.py
. We will discuss some of the important methods from this file. You can go through the rest of the code from this file.Download the image files,
droplet.png
,cloud.png
,car.png
, andlightening.png
from the Packt website. Place these image files in a sub-directory calledimages
. Theimages
directory should be placed in the directory where the Python source file is located.The constructor of the class is written as follows:
1 def __init__(self, width=None, height=None): 2 pyglet.window.Window.__init__(self, 3 width=width, 4 height=height, 5 resizable=True) 6 self.drawableObjects = [] 7 self.paused = False 8 9 10 self.createDrawableObjects() 11 self.adjustWindowSize() 12 # Make sure to replace the following media path to 13 # with an appropriate path on your computer. 14 self.horn_sound...