我不能在pygam中使用多个字体

2024-03-29 13:07:42 发布

您现在位置:Python中文网/ 问答频道 /正文

这听起来是个愚蠢的问题,但我没法让它起作用。你知道吗

from pygame import *
from random import *
from math import *
import os
from datetime import datetime
#importing all needed modules
mixer.init() #initializing mixer for sound use
init() #initializing pygame
font.init() #Just to prove that it still doesn't work
SCREEN = (1000,700)
os.environ['SDL_VIDEO_WINDOW_POS'] = "%d, %d" %(350, 25)
screen = display.set_mode(SCREEN)

font = font.SysFont("Times New Roman", 52)
font2 = font.SysFont("Times New Roman", 12)

第一个可行,但第二个抛出错误: 内置属性错误: 'pygame.font.font'对象没有属性'SysFont'

一直有这个问题,需要使用字体,因为我需要blit变量的变化。你知道吗


Tags: fromimportnewdatetimeinitos错误screen