clock - Is there any Python module available which can alarm after certain time -
there significant difference between question , given one. if implement sleep given on link poeple think duplicate of question whole app hang time. on other hand looking scheduler. app not hang after period of time .wav file run. meanwhile able using app. hope makes sense.
i going build alarm clock. think can according algorith...
- take current time using
time.clock()
- compare current time given time.
- if current time not given time continue taking current time , compare whether current time given time or not.
- if current time given time play .wav file.
the problem program continuously run until given time. looking better idea. let's if there python module/class/function can play sound file on given time. there python module/class/function can wake on given time? or algo used alarm clocks?
have @ sched module.
here's example on how use it:
import sched, time, datetime def print_time(): print("the time now: {}".format(datetime.datetime.now())) # run 10 seconds when = time.time() + 10 # create scheduler s = sched.scheduler(time.time) s.enterabs(when, 1, print_time) # run scheduler print_time() print("executing s.run()") s.run() print("s.run() exited")
the time now: 2015-06-04 11:52:11.510234 executing s.run() time now: 2015-06-04 11:52:21.512534 s.run() exited
Comments
Post a Comment