我试图在pygame中将一个基本的SQLite数据库显示为一个表。它保存玩家的用户名和分数。我现在的代码显示了它,但它没有很好地对齐。守则:
def leader_board():
i = 35
messg = font_style.render(f'PLAYER SCORE', True, yellow)
dis.blit(messg, [dis_width / 5, (700 / 4) + 5])
cur.execute('SELECT * FROM snake_score ORDER BY score desc LIMIT 10')
rows = cur.fetchall()
for row in rows:
mesgg = font_style.render('{:>3} {:30}'.format(row[0], row[1]), True, yellow)
dis.blit(mesgg, [dis_width / 5, (700 / 4) + i + 5])
i += 35
我希望所有数字都与“分数”一词的结尾对齐。任何帮助都将被感激,因为我尝试了一些东西,但似乎没有一个奏效
使用单空格字体或分别呈现每列的文本:
相关问题 更多 >
编程相关推荐