- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
secs = 0
fsecs = 0.0
mins = 40
lastsecs = 0
prevsecs = 0
def getTimeStr() :
def f ( x ) :
if ( 10 <= x <= 19 ) : return ''
y = x % 10
if ( y == 1 ) : return 'а'
if ( 2 <= y <= 4 ) : return 'ы'
return ''
return 'Время: %d минут%s %d секунд%s' % ( mins , f ( mins ) , secs , f ( secs ) )
def updateTimer() :
global timeString , root , secs , fsecs , lastsecs , prevsecs , mins
if ( fin ) : return
prevsecs , lastsecs = lastsecs , clock()
t = secs
if ( fsecs > 0 ) :
fsecs -= lastsecs - prevsecs
secs = int ( fsecs )
elif ( mins > 0 ) :
mins -= 1
fsecs = 60 + fsecs - lastsecs + prevsecs
secs = int ( fsecs )
else :
finish()
if ( secs == t ) :
timeString [ 'text' ] = getTimeStr()
root.after ( 100 , updateTimer )