"Petr Jakeš" <petr.jakes@tpc .czwrote:
import time
while True:
end_time = time.time() + 5
while time.time() < end_time:
do_the_in_betwe en_stuff()
do_the_every_fi ve_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.
>"Leon Zhang" <safecom@gmail. comwrote:
>
>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.
>
>>
>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.
>>
>>
>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.
>>
>>
>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_betwe en_stuff()
do_the_every_fi ve_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.
Comment