<br><br><div><span class="gmail_quote">On 3/4/06, <b class="gmail_sendername">Ingo</b> <<a href="mailto:seedseven@home.nl">seedseven@home.nl</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
To make a time lapse video I've been playing with the sched module.<br>There is one problem I run into, in the code below, how do I get the<br>returned value t from printtime into main?<br><br><br>import time<br>from sched import scheduler
<br><br>class time_lapse(scheduler):<br><br> def time_lapse(self, start_time, stop_time, interval, priority,<br>action, argument):<br> def lapse():<br> action(*argument)<br> i=self.enter(interval, priority, lapse, ())
<br> if stop_time:<br> if stop_time<self.timefunc():<br> self.cancel(i)<br> self.enterabs(start_time, priority, lapse, ())<br><br>def printtime(strf=None):<br> t=time.time
()<br> if strf:<br> print time.strftime("%Y%m%d_%H%M%S")<br> else:<br> print time.localtime()<br> return t<br><br>def main():<br> schedule = time_lapse(time.time, time.sleep)<br> start=
time.time()<br> stop=list(time.localtime(start))<br> stop[3]=stop[3]+2<br> stop=time.mktime(stop)<br><br> #schedule.time_lapse(None,None,5,1,printtime,()) #start now, run<br>forever<br> schedule.time_lapse(start,stop,7,0,printtime,(1,))
<br><br> schedule.run()<br><br><br>if __name__ == "__main__":<br> main()<br><br><br>Ingo<br><br>_______________________________________________<br>Tutor maillist - <a href="mailto:Tutor@python.org">Tutor@python.org
</a><br><a href="http://mail.python.org/mailman/listinfo/tutor">http://mail.python.org/mailman/listinfo/tutor</a><br></blockquote></div><br>
main(printtime(strf=None))<br>
<br>
should do it. Alternately:<br>
<br>
tt = printtime(strf=None)<br>
main(tt)<br>
<br>
Anna<br>