- def blit(self,surface):
- '''
- Draw the circle on surface
- '''
-
- newPos = (self.centerPosition[0] - self.image.get_width() / 2, self.centerPosition[1] - self.image.get_height() / 2)
- surface.blit(self.image, newPos)
+ def iterImages(self) :
+ for img in cycle(self.images) :
+ yield img
+
+ @event_handler(TIMEOUT)
+ def loadNext(self, event) :
+ if self.blink :
+ self.image = self.iterator.next()
+
+ @event_handler(pygame.MOUSEBUTTONDOWN)
+ def flashOn(self, event) :
+ self.blink=False
+ self.image = self.flashImage
+
+ @event_handler(pygame.MOUSEBUTTONUP)
+ def flashOff(self, event) :
+ self.blink = True
+ self.loadNext(event)
+
+ @event_handler(pygame.MOUSEMOTION)
+ def move(self, event) :
+ x, y = event.rel
+ self.rect.centerx += x
+ self.rect.centery += y
+ #self.rect.move_ip(*rel)