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