Re: [orca-list] time...



Hi Daniel:

See http://www.pygtk.org/pygtk2reference/gobject-functions.html#function-gobject--timeout-add

The basic pattern is this:

1) add the timeout (in milliseconds):

    gobject.timeout_add(1000, myMethod)

2) write your method:

    def myMethod():
        <<<output braille>>>
        return True

With the example above, myMethod will be called once a second. No need to do a loop in myMethod since the timeout is basically doing the timed loop for you.

Will

Daniel Dalton wrote:
Hi Will,

On Fri, 16 May 2008, Willie Walker wrote:


If you're doing this from Orca, you cannot do it in an infinite loop. If you do so, you will freeze the system as you have discovered.

Indeed :-)


An appropriate way to do this kind of thing would be to do one update at a time via a timeout (look for gobject.timeout_add calls in the Orca sources for an example).

Looks complicated, I am currently studying my python book and thought this could be a quick thing to impliment. Perhaps I should continue with my studying and not work on this until I get a better understanding of python?

Anyway how does this work? Does it just stop repeating the code once a timeout is reached?
Or does it stop when a certain event occurs?

Thanks for your reply!

Cheers,

Daniel.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]