def notify(self, event): if event.type == pygame.MOUSEBUTTONDOWN: if event.button == MOUSE_LEFT: if self.rect.collidepoint(event.pos): self.method()