Can I set up a timed callback without Tkinter or twisted orsomething?

Hendrik van Rooyen mail at microcorp.co.za
Sun Oct 15 02:31:58 EDT 2006


"Scott David Daniels" <scott.daniels at acm.org> wrote:


> Hendrik van Rooyen wrote:
> > I want to do the equivalent of the after thingy in tkinter - setting up in
> > effect a timed call back.
> >
> > My use case is as a "supervisory" timer - I want to set up an alarm, which I
> > want to cancel if the expected occurrence occurs - but its not a GUI app.
>
> Use a thread that uses something like:
>        def action():
>            sleep(50)
>            if not canceled:
>                callback(foo)
> as its action.
>
> The callback ill be in another thread, but ....  Look up threading for
> more details.

Thanks - I was hoping that I did not have to do it myself - the Tkinter thingy
works nicely - I was hoping that the interpreter could handle something like
this... What I don't like too much about the sleep based solution is that yer
blind and deaf while sleeping - at least in that thread - and I am trying for
fairly fine grained timing resolution...

is there not something based on signals?  - I seem to recall some such thing
here in another thread.. ( I am running Linux)

-Hendrik




More information about the Python-list mailing list