5
我是pygame的新手,想要编写一些代码,每10秒只将图像旋转90度。我的代码看起来是这样的:使用pygame旋转图像
import pygame
import time
from pygame.locals import *
pygame.init()
display_surf = pygame.display.set_mode((1200, 1200))
image_surf = pygame.image.load("/home/tempuser/Pictures/desktop.png").convert()
imagerect = image_surf.get_rect()
display_surf.blit(image_surf,(640, 480))
pygame.display.flip()
start = time.time()
new = time.time()
while True:
end = time.time()
if end - start > 30:
break
elif end - new > 10:
print "rotating"
new = time.time()
pygame.transform.rotate(image_surf,90)
pygame.display.flip()
此代码不工作即,图像不旋转时,虽然“旋转”正在打印在每10秒的终端。有人可以告诉我我做错了什么吗?