[Tutor] please help me with after method
Alan Gauld
alan.gauld at yahoo.co.uk
Thu Nov 17 19:05:26 EST 2016
On 17/11/16 22:07, Alan Gauld via Tutor wrote:
>> def displayCountdown():
>> lcd = "{:02d}:{:02d}".format(*divmod(t, 60))
>> timeString.set(lcd)
>> setTime -= 1
>> if setTime > 0:
>> root.after(1000,displayCountdown)
>>
>
> Where is 't' (used in the divmod) defined? Looking below I think
> it should use setTime?
Also, because you modify setTime, you need to declare
it as global.
So the function should look like:
def displayCountdown():
global setTime
lcd = "{:02d}:{:02d}".format(*divmod(setTime, 60))
timeString.set(lcd)
setTime -= 1
if setTime > 0:
root.after(1000,displayCountdown)
--
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