当使用pygam输出到屏幕上时,来自SQL数据库的数据重叠

2024-04-20 08:50:41 发布

您现在位置:Python中文网/ 问答频道 /正文

高分页的这部分工作不正常。你知道吗

现在的情况是,数据库中的数据被打印到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()

有人知道解决办法吗?你知道吗


Tags: messagedatelinerenderscreenpygamecolorscore