Modify the face class from the previous problem to include


Modify the face class from the previous problem to include a move method similar to other graphics objects. Using the move method, create a program that makes a face bounce around in a window (see Programming Exercise 17 from Chapter 7). Bonus: have the face change expression each time it "hits" the edge of the window.

Exercise 17:

Write a program to animate a circle bouncing around a window. The basic idea is to start the circle somewhere in the interior of the window. Use variables dx and dy (both initialized to 1) to control the movement of the circle. Use a large counted loop (say 10000 iterations), and each time through the loop move the circle using dx and dy. When the x-value of the center of the circle gets too high (it hits the edge), change dx to -1. When it gets too low, change dx back to 1. Use a similar approach for dy.
Note: Your animation will probably run too fast. You can slow it down by using the sleep function from the time library module.
from time import sleep
...
sleep(0.005) # pauses the program for 5 thousandths of a second.

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: Modify the face class from the previous problem to include
Reference No:- TGS01704992

Expected delivery within 24 Hours