[Tutor] Countdown Clock Programming Question

Alan Gauld alan.gauld at btinternet.com
Tue Nov 24 16:37:43 EST 2015


On 24/11/15 19:48, Laura Creighton wrote:
> Welcome Evan.
>
> In a message of Tue, 24 Nov 2015 18:19:22 +0000, Alan Gauld writes:
>> def update_display()
>>    display_period = target_time - time.time()
>>    min,sec = divmod(display_period,60)
>>    if min < 2: set color to yellow
>>    elif: min < 1: set color to red
>>    else: set color to green
>>    set label text to min/sec
>>    after(1000, update_display)
> You'd better check them in red, yellow, green order, or the reverse.
>
>       if min < 1:
>       	 set colour to red
>       elif min < 2:
>          set colour to yellow
>       else:
>          set colour to green
>
> Your pseudo-code will only show yellow and green colours.

Oops, yes. Good catch.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos



More information about the Tutor mailing list