"Petr Jakeš" <[EMAIL PROTECTED]> wrote: >"Leon Zhang" <[EMAIL PROTECTED]> wrote: > >> >> I am not an expert, but why not to use time.sleep(5)? >> If you are using wxPython, you may also try wx.Timer, in which you could >> set its interval. >> >> >Thanks for your reply. >During the 5s period my script has to do some stuff instead of sleeping. >Thats why it runs in the loop and once in 5s period it has to trigger some >other stuff(function, method, action) to do.
import time while True: end_time = time.time() + 5 while time.time() < end_time: do_the_in_between_stuff() do_the_every_five_second_stuff() HTH - Hendrik -- Real programmers disdain structured programming. Structured programming is for compulsive neurotics who were prematurely toilet-trained. They wear neckties and carefully line up pencils on otherwise clear desks. -- http://mail.python.org/mailman/listinfo/python-list