tags:

views:

236

answers:

1

Hi there,

I'm using gobject.timeout_add() to display a timer in my project (dojotools).

I was wondering if there is any other way to achieve the same results, but without the gobject dependency.

The requirement is just calling a method repeatedly, in a certain time interval.

+1  A: 

You can use a thread with time.sleep(interval) to achieve the same effect.

import thread, time

def timer():
    while True:
        time.sleep(1)
        # do something here

thread.start_new_thread(timer, ())
lunixbochs