[Tutor] Making a function run every second.

Alan Gauld alan.gauld at btinternet.com
Wed Nov 30 02:23:40 CET 2011


On 29/11/11 14:54, Mic wrote:

> I want a function to run every second , how do I do that?
>
> Say that the function look like this:
>
> def hi():
> print("hi")

The answer depends on whether you want to do it in a GUI or in a command 
line program.

Since your other posts have included GUI code I'd suggest you check out 
the documentation for the after() method in Tkinter.

If it's for command line look at time.sleep()

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/



More information about the Tutor mailing list