AttributeError:模块'pygame.font'没有属性'SySFont'

时间:2018-08-22 11:13:49

标签: python pygame

当我要执行程序时,发生以下错误:

  

AttributeError:模块'pygame.font'没有属性'SySFont'

我该如何解决?

import pygame, sys
from pygame.locals import *
pygame.init()
windowSurface=pygame.display.set_mode((500,400),0 ,32)
black = (0,0,0)
white = (255,255,255)
red = (255,0,0)
green = (0,255,0)
blue = (0,0,255)
baseFont = pygame.font.SySFont(None, 48)
text = baseFont.render('x',True,white,blue)
simpleText = text.get_rect()
simpleText,centerx = windowSurface.get_rect().centerx
simpleText,centery = windowSurface.get_rect().centery
windowSurface.blit(text,simpleText)

1 个答案:

答案 0 :(得分:0)

SysFont而不是SySFont

注意:由于没有其他答案,因此在评论中添加答案。