I have some code:
mouseX, mouseY = pygame.mouse.get_pos()
angle = math.degrees(math.atan2(mouseY - self.rect.centery, mouseX - self.rect.centerx))
rotated = pygame.transform.rotate(self.rect, -angle)
self.rect = lol.get_rect()
How should I modify this code to slowly turn the rectangle depending on the mouse angle (10deg/s etc.)?
Edit: I want to rotate CLASS object (based on pygame.sprite.Sprite class)
Just don't rotate your image to the target angle, but only a little bit until you reach the target angle.
Here's a very simple example. The arrow will slowly follow the mouse: