2
我已经在python 3.5.3上使用programarcadegames.com上的说明安装了pygame 1.9.4版。当我使用pygame绘制线条和形状时,它很好,但是当我尝试使用pygame.font.SysFont
时,pygame不再响应。例如,当我运行下面的代码无响应pygame的窗口会显示:Pygame在试图在macOS上显示文本时未响应Sierra
import pygame
pygame.init()
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
size = (400, 500)
screen = pygame.display.set_mode(size)
done = False
clock = pygame.time.Clock()
while not done:
for event in pygame.event.get(): # User did something
if event.type == pygame.QUIT: # If user clicked close
done = True # Flag that we are done so we exit this loop
screen.fill(WHITE)
font = pygame.font.SysFont(None, 25, True, False)
text = font.render("Some Text", True, BLACK)
screen.blit(text, [0, 0])
pygame.display.flip()
clock.tick(60)
pygame.quit()
只是尝试'font = pygame.font.SysFont(None,25,True,False)',也许它没有找到Calibri – PRMoureu
@PRMoureu谢谢,但那不起作用。 – Dandelion
你如何运行这个程序? ---可能与问题无关,但更好的定义while循环上面的字体(这一行:'font = pygame.font.SysFont(None,25,True,False)')。 – skrx