import pygame
import time
import random
pygame.init()
pygame.display.set_caption('贪吃蛇')
font_style = pygame.font.Font("C:/Windows/Fonts/STFANGSO.TTF", 20)
score_font = pygame.font.Font("C:/Windows/Fonts/STCAIYUN.TTF", 30)
错误代码:
Traceback (most recent call last):
File "C:\Users\Administrator\Desktop\python\贪吃蛇.py", line 7, in
font_style = pygame.font.Font("C:/Windows/Fonts/STFANGSO.TTF", 20)
FileNotFoundError: [Errno 2] No such file or directory: 'C:/Windows/Fonts/STFANGSO.TTF
本地电脑上有这个文件吗?'C:/Windows/Fonts/STFANGSO.TTF
这两个都是字体文件,先把字体文件安装好,或者使用其他字体。
这两个TTF文件你本地没有哦,需要先下载这两个文件,如果没有的话,你也可以先不写这两行,使用系统默认的字体