Hands-on Day

For today's activity, you will be using inheritance in the cs1graphics framework to refine a new Face class. We'll get you started with face.py that has a preliminary definition and an embedded demo script that, if the class is completed, will produce the following animation.

We have provided an initial constructor (though you will need to modify that constructor to succeed), and we've given an implementation of a setColor method.  Here are the methods you should provide in order to support the given animation.

While our script won't call closeEyes or openEyes twice in a row, your class would be better if it maintains state information to know whether eyes are open, so that it can robustly handle such duplicative calls. Similarly, consider what happens if frown() were called rom a state when already frowning.


Michael Goldwasser
Last modified: Wednesday, 25 December 2019