- self.rect = pygame.Rect((0,0), (self.width, self.height))
+ # workarround cursor alignement problem
+ pygame.event.set_blocked(pygame.MOUSEMOTION)
+ pygame.mouse.set_pos(pygame.mouse.get_pos())
+ pygame.event.set_allowed(pygame.MOUSEMOTION)
+ # ---
+ x, y = pygame.mouse.get_pos()
+ print 'mouse pos :', x, y
+ left = x - self.width / 2
+ top = y - self.height / 2
+ self.rect = pygame.Rect((left, top), (self.width, self.height))