C:\Users\ABDUL HAIYAN\Desktop\Programming\Python\Tic Tac Toe\dist>tictactoe
pygame 2.0.1 (SDL 2.0.14, Python 3.8.8)
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
File "tictactoe.py", line 181, in <module>
File "tictactoe.py", line 47, in game_opening
File "tictactoe.py", line 60, in draw_status
File "pygame\pkgdata.pyc", line 84, in getResource
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\ABDUL HAIYAN
\\Desktop\\Programming\\Python\\Tic Tac Toe\\dist\\library.zip\\pygame\\freesans
bold.ttf'
已在其中的文件:
我建议您阅读this page以熟悉
pygame.font
模块获取文件的3种方法:
一,。解压缩所需的文件
在这种情况下,应该使用Python打开
.zip
,然后提取.ttf
文件,根据需要打开/读取它,然后删除提取的字体文件如果希望Python在
.zip
文件中打开文件,则应使用如下ZipFile模块:二,。使用^{}
此模块从系统字体导入字体(即Word中可用的字体等)
语法:
例如:
在这种情况下,您甚至不需要
.ttf
文件三,。运行程序时解压缩文件夹
当然!你为什么要压缩文件夹?解压需要几秒钟的时间…
或者,您可以简单地将文件放在普通文件夹中,而不是
.zip
相关问题 更多 >
编程相关推荐