+
+ def setPosition(self, pos) :
+ self.dirty = 1
+ x, y = pos
+ rx, ry = self.rect.centerx, self.rect.centery
+ self.rect.move_ip(x-rx, y-ry)
+
+
+class ForeverTimer(Thread) :
+ def __init__(self, duration, func, *args, **kw) :
+ Thread.__init__(self)
+ self.duration = duration / 1000.
+ self.func = func
+ self.args = args
+ self.kw = kw
+ self.running = True
+
+ def run(self) :
+ while self.running :
+ self.func(*self.args, **self.kw)
+ time.sleep(self.duration)
+
+ def stop(self) :
+ self.running = False
\ No newline at end of file