【发布时间】:2020-10-07 14:26:16
【问题描述】:
我正在尝试在 pygame 窗口中逐行打印 json。问题是,我不能换一条新路线。我写了这段代码:
def printDict(griglia, nRighe, nColonne, cella, jsonTesto):
textsurface = myfont.render(jsonTesto, False, (255, 255, 255))
screen.fill(pygame.Color("yellow"), (0, nRighe*cella+2*cella*cella, nColonne*cella+cella, nRighe*cella+3*cella*cella))
screen.blit(textsurface, (cella, nRighe*cella+4*cella))
pygame.display.update()
它在我想要的地方打印并覆盖旧的书面内容,但是当我得到结果时,它是内联的,并且在应该换行的地方有“]”。
或者,您可以通过限制条件来帮助我吗?我的意思是,是否可以在窗口结束时使文本换行?
你能帮帮我吗?
【问题讨论】:
-
来自the documentation:“文本只能是单行:不呈现换行符。”您必须逐条绘制。
-
非常感谢!我希望有技巧啊……没关系:)