from peak.events.trellis import * from peak.events.activity import * from threading import Thread class ThreadedComponent(Component): updating = attr(False) iteration = attr(0) time_to_update = attr(EPOCH) @maintain def do_update(self): if self.updating and self.time_to_update: #print 'UPDATING' self.iteration += 1 if self.iteration == 2: EventLoop.stop() self.time_to_update = Time[0.1] bool(self.time_to_update) # make sure we depend on new value c = ThreadedComponent() def start_updating_in_thread(): c.updating = True th = Thread(target=start_updating_in_thread) th.start() EventLoop.run()