Protecting against callbacks queuing up?

Hendrik van Rooyen hendrik at microcorp.co.za
Tue Aug 25 12:02:31 EDT 2009


On Tuesday 25 August 2009 15:21:16 Esben von Buchwald wrote:
> Dennis Lee Bieber wrote:
> > On Mon, 24 Aug 2009 17:32:23 +0200, Esben von Buchwald
> > <find.mig at paa.google> declaimed the following in
> >
> > gmane.comp.python.general:
> >> I'm new to python, what is an after function and an after call? Couldn't
> >> find excact answer on google...? Do you have a link to some docs?
> >
> > 	They would be particular to whatever GUI/event library is in use.
> > They aren't part of Python itself.
>
> This is how the accelerometer is accessed
> http://pys60.garage.maemo.org/doc/s60/node59.html
>
> I found this called "after"...
> http://pys60.garage.maemo.org/doc/s60/node12.html
>
> would that be usable?
Probably
>
> If so, how?

This is a guess, for your device,  but I suspect
something along these lines:

t = Ao_timer()

cb = t.after(100,thing_that_does_the_work(with_its_arguments))

Lots of assumptions here - the 100 should give you a tenth of a second...
Don't know what the arguments look like, and if you need to pass an instance 
(like self) - that would depend on where you are calling it from.

Play and see :-)

You should also be able to cancel the callback like this:

t.cancel(cb)

If you do it before the time out

- Hendrik




More information about the Python-list mailing list