Python 有没有办法改变图像的中心?旋转图像

Python 有没有办法改变图像的中心?旋转图像,python,pygame,Python,Pygame,嘿,我的社区, 我尝试旋转图像,但不是围绕图像中心旋转。有没有办法改变图像的中心,使其围绕新的中心旋转。(对不起我的英语) 这是我试图旋转图像的代码。不,它围绕图像的模型旋转。 代码: 提前谢谢 import pygame import sys import math from pygame.locals import * pygame.init() clock = pygame.time.Clock() Screen_size = (500,500) screen = pygame.dis

嘿,我的社区, 我尝试旋转图像,但不是围绕图像中心旋转。有没有办法改变图像的中心,使其围绕新的中心旋转。(对不起我的英语)

这是我试图旋转图像的代码。不,它围绕图像的模型旋转。 代码:

提前谢谢

import pygame
import sys
import math

from pygame.locals import *
pygame.init()

clock = pygame.time.Clock()
Screen_size = (500,500)
screen = pygame.display.set_mode(Screen_size)
display = pygame.Surface((250,250))

test_img = pygame.image.load("Sword_left.png")
angle = 0

while True:
    display.fill((0,0,0))
    
    for event in pygame.event.get():
        if event.type == QUIT:
            pygame.quit()
            sys.exit()
            
    angle += 2
    rot_img = pygame.transform.rotate(test_img,angle)
    display.blit(rot_img,(120 - int(rot_img.get_width()/2),120 - int(rot_img.get_height()/2)))
    screen.blit(pygame.transform.scale(display,Screen_size),(0,0))
    pygame.display.update()
    clock.tick(60)