我的图像不会显示在屏幕上,但没有任何错误。我查了一下,没有找到适合我的解决方案。
代码:
import pygame
pygame.init()
sw = 500
sh = 500
win = pygame.display.set_mode((sw,sh))
fps = pygame.time.Clock()
x = (sw * 0.3)
y = (sh * 0.95)
# also tried just convert() and no convert at all
player = pygame.image.load('SH.png').convert_alpha()
white = (255, 255, 255)
def Player(x, y):
win.blit(player, (x, y))
dead = False
run = True
while not dead:
for event in pygame.event.get():
if event.type == pygame.QUIT:
dead = True
win.fill(white)
Player(x, y)
pygame.display.update()
fps.tick(60)
pygame.quit()
答案 0 :(得分:0)
我把图像缩小了,因为它太大了并且不在屏幕上。
这解决了问题