[Tutor] How to enable pausing my timer.py ?

Alan Gauld alan.gauld at blueyonder.co.uk
Wed Jul 7 21:25:25 CEST 2004

> I just realized that my stopwatch was really a timer: you set it to
> after a length of time you enter; it stops and beeps when that time
is up.

You could make it even more general purpose buy putting the guts of it
in a function called say, doAfter()

def doAfter(t,f):
''' t is the time required and f is a function to be executed
    after t expires.'''

Thus in your current case you would call

doAfter( t, lambda : winsound.beep(500) )

Just a thought... :-)

Alan G.

More information about the Tutor mailing list