使用pygame输出到屏幕上时,SQL数据库中的数据重叠

时间:2017-04-21 19:37:16

标签: python sql

高分页面的这一部分无法正常工作。

发生了什么,是数据库中的数据打印到pygame上但它们相互重叠,例如

name1,score 100,date位于name2,score 80,date之上。

这是代码,谢谢。

def highScoreScreen():

    screen.fill(background_color)
    YChange = 50
    sql = "SELECT * FROM ScoreBoard ORDER BY Scores DESC LIMIT 10"
    c.execute(sql)
    line = "line"

    while True:
         line = c.fetchone()
        highscore_heading_message = highscore_heading_message_font.render("Welcome To The League Of The Top Players!",1,pygame.Color("red"))
        leaderboard = leaderboard_font.render(str(line[1:]),1,pygame.Color("yellow"))
        highscore_homescreen_message = homescreen_font.render("Main Menu? Press M",1,pygame.Color("green"))
        highscore_playagain_message = highscore_playagain_message_font.render("Play Again? Y/N",1,pygame.Color("green"))
        screen.blit(highscore_heading_message,(175,10))
        screen.blit(highscore_homescreen_message,(100+20,500+20))
        screen.blit(highscore_playagain_message,(500+20,500+20))
        screen.blit(leaderboard,(SCREEN_WIDTH/2 - 125,YChange))
        pygame.display.update()

有人知道修复吗?

0 个答案:

没有答案