import pygame
import random
pygame.init()
win = pygame.display.set_mode((500,500))
pygame.display.set_caption("")
surf = pygame.Surface((100, 75))
pygame.draw.rect(surf, (255, 255, 255), (20, 20, 100, 75))
pygame.time.set_timer(pygame.USEREVENT, 10)
run = True
surfrotate = 0
while run:
for event in pygame.event.get():
if event.type == pygame.QUIT:
run = False
if event.type == pygame.USEREVENT:
surfrotate +=1
win.fill((0,0,0))
rimage = pygame.transform.rotate(surf, surfrotate)
win.blit(rimage,(50, 20))
if surfrotate == 360:
surfrotate = 0
pygame.display.update()
pygame.quit()
|