Week 12, Monday: More Classes



finish the Clock class

Here are all of the methods you need to write to get the clock class to work:

digital clock

Once you have the clock class written, the digital-clock.py program should display a clock using Zelle graphics.

alarm clock

Suppose we want to turn this into an alarm clock, that flashes red when the alarm is going off. What do we need to add to the clock class to get this to work?

alarm clock picture

In particular, I would like to be able to do something like this to set the alarm:

digclock.setAlarm(h,m,s+10)

And then something like this to see if we are in the alarm "state" or not:

if digclock.inAlarm():
  gw.setBackground("red")