Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/359.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Pygame字体在Windows上的位置?_Python_Text_Fonts_Pygame - Fatal编程技术网

Python Pygame字体在Windows上的位置?

Python Pygame字体在Windows上的位置?,python,text,fonts,pygame,Python,Text,Fonts,Pygame,我想知道在我自己的游戏中使用pygame Impact字体的位置。如果我使用pygame.font.get\u font()Impact在列表中 我导航到所有Python和PyGame文件夹(不做任何更改),发现最相似的文件夹是font.h 我将Windows10与Python3.7和PyGame1.9.4一起使用 我查看的路径是C:\Users\[Username]\AppData\Roaming\Python37\Include\pygame 我希望该字体位于Python37文件夹的pyga

我想知道在我自己的游戏中使用pygame Impact字体的位置。如果我使用
pygame.font.get\u font()
Impact在列表中

我导航到所有Python和PyGame文件夹(不做任何更改),发现最相似的文件夹是
font.h

我将Windows10与Python3.7和PyGame1.9.4一起使用

我查看的路径是
C:\Users\[Username]\AppData\Roaming\Python37\Include\pygame


我希望该字体位于Python37文件夹的pygame文件夹中。

可用字体取决于系统。但是,您可以通过调用:
pygame.font.get\u fonts()
获得所有可用字体的列表

您可以使用
pygame.font.font()
加载任何TrueType字体文件(*.ttf)。要在项目目录中加载字体文件myfont.ttf,只需调用
pygame.font.font(“myfont.ttf”,size)
。如果第一个参数位于其他位置,请将其替换为文件路径。您可以使用相对或绝对文件路径

所以我假设目录中没有预先保存的字体