我在Pygame窗口中打印格式化的文本。除了我想要放在两个值之间的换行符('\n'
)之外,全文正确打印。新系列作为一个盒子出现,就像在非UNICODE区域打印UNICODE字符一样。
无论如何,看看:
def updateScoreBoard():
font=pygame.font.SysFont(None,14)
text=font.render('Score: %05d \n Egg Caught: %03d' %(SCORE,EGGSCAUGHT),True,pygame.Color(255,255,255))
textRect=text.get_rect()
mainSurface.blit(text,textRect)
请参阅零和' Egg之间的框? 然后我用这个更新了代码:
NEWLINE='\n'
def updateScoreBoard():
font=pygame.font.SysFont(None,14)
text=font.render('Score: %05d %s Egg Caught: %03d' %(SCORE,NEWLINE,EGGSCAUGHT),True,pygame.Color(255,255,255))
textRect=text.get_rect()
mainSurface.blit(text,textRect)
仍然是相同的结果。我现在做什么?