- 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()
+ self.update()
+
+ @event_handler(MOUSEBUTTONDOWN)
+ def flashOn(self, event) :
+ self.blink=False
+ self.image = self.flashImage
+ self.update()
+
+ @event_handler(MOUSEBUTTONUP)
+ def flashOff(self, event) :
+ self.blink = True
+ self.loadNext(event)
+
+ def update(self) :
+ surface = pygame.display.get_surface()
+ surface.blit(self.image, self.rect)