如何在多行显示字符串?

时间:2017-10-11 00:53:05

标签: string python-3.x blit pygame-surface

我正在写一篇" High Scores"我的pygame的表窗口。目前我正在取消文件,然后将元组分开,这样我就可以在左边显示播放器名称,在右边显示分数。然而,在当前配置中,所有玩家名称都堆叠在彼此的顶部并且与得分相同。我需要弄清楚如何在新线上显示每个新玩家名称和得分组合。我仍然是python的新手(使用版本3),任何帮助将不胜感激!

for x in high_scores:
    (Playername, score) = (x[0], x[1])
    print(Playername)
    Playername = Playername.rjust(25, " ")
    score = str(score)
    score = score.rjust(50, " ")
    megastring = megastring + Playername
    megastring = megastring + score

    Playersurface = myfont.render(str(Playername), True, (0, 0, 0))
    HighScoreScreen.blit(Playersurface,(0,0))
    scoresurface = myfont.render(str(score), True, (0, 0, 0))
    HighScoreScreen.blit(scoresurface,(0,0))

谢谢!

0 个答案:

没有答案