[Tutor] How to enable pausing my timer.py ? (original) (raw)
Alan Gauld alan.gauld at blueyonder.co.uk
Wed Jul 7 21:25:25 CEST 2004
- Previous message: [Tutor] How to enable pausing my timer.py ?
- Next message: [Tutor] Dictionary of dictionaries of dictionaries of lists.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I just realized that my stopwatch was really a timer: you set it to beep 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.
- Previous message: [Tutor] How to enable pausing my timer.py ?
- Next message: [Tutor] Dictionary of dictionaries of dictionaries of lists.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]