[Tutor] Access to Windows Timers / Idle "states"??

Javier JJ python.tutorial@jarava.org
Wed, 6 Jun 2001 15:25:09 +0200


> >
> > Am I making any sense at all?
>
> Sort of :-). I don't use windows anymore, so I can only help with the
timer
> thing.. the command for it is time.sleep(5) to sleep for 5 seconds. If you
want
> to set hours or minutes, the way to do so is this: time.sleep(60*60*3.5)
for 3.5
> hours, for instance. Also, you have time.time() which gives you current
time in
> seconds from the start of epoch (~1970).

That's really the way :-)) I only need to delay an action a set amount of
time, nothing really fancy (I know if I had to sichronize serveral things,
then I'd have to "really" build a timer to use a "general" event", But for
what I need, time.sleep probably will fit nicely :-)

> Anyway, in order for timer to work, here's what you can do:
>
> sense_keypress()

I guess the trick is here :-) I'll have to build this function.... the trick
is how, I guess :-))

> time.sleep(60)
> if not keypresses_happened():
>     os.kill(someprog)
>
> Look at docs for os.kill.

Will do :-) Pity is, "avaliability: UNIX".That's what I "Love" about
"pskill" form sysinternals... it's like kill, only for windows :-)

> time.time() you can use to tell how long something took, like this:
>
> t = time.time()
> do_something()
> print 'do_something() took %d seconds' % (time.time() - t)
>

Thanks a lot for the help :-)

    Javier
----

Famous last words - Don't worry, I can handle it.