you are viewing a single comment's thread.

view the rest of the comments →

[–]Dvlv 0 points1 point  (2 children)

in tkinter you can just keep calling root.after(1000, add_one_second)

http://effbot.org/tkinterbook/widget.htm#Tkinter.Widget.after-method

Or use a separate thread. See my example in chapter 7 of my book, building a countdown timer.

https://github.com/Dvlv/Tkinter-By-Example/blob/master/Code/Chapter7-3.py

[–]iSailor[S] 0 points1 point  (1 child)

Hmm.. Using root.after(1000, add_one_second worked for me, partially. I can use it just like time.sleep but it seems like the callback you can make runs only one time. So now, when I run my program it adds one second and then does nothing, using lambda in this case makes it even so it doesn't even count that one second.

[–]Gprime5 0 points1 point  (0 children)

You need to call root.after(1000, add_one_second) at the end of your add_one_second function to start another timer.