import pygame, sys def rotate(surface,angle): rotated_surface = pygame.transform.rotozoom(surface,-angle,1) rotated_rect = rotated_surface.get_rect(center = (300,300)) return rotated_surface,rotated_rect pygame.init() clock = pygame.time.Clock() screen = pygame.display.set_mode([600,600]) cat = pygame.image.load("cat.jpg") cat_rect = cat.get_rect(center = (300,300)) angle = 0 while True: for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() sys.exit() angle += 1 screen.fill((255,255,255)) cat_rotated,cat_rotated_rect = rotate(cat,angle) screen.blit(cat_rotated,cat_rotated_rect) pygame.display.flip() clock.tick(30)