问题描述
下面的代码试图在 pygame 窗口上显示简单的文本,但它得到一个错误,说 render() 没有关键字参数。
font = pygame.font.Font(pygame.font.get_default_font(),36)
text_surface = font.render('Hello world',antialias=True,color=(0,0))
display.blit(text_surface,dest=(0,0))
解决方法
很多人都遇到过这个问题。
不要使用关键字参数。
text_surface = font.render('Hello world',True,(0,0))