有没有办法在按下按钮后永久显示这些设置?

Is there any way to permanently display these settings after pressing the button?

我尝试在按下按钮后显示设置列表,问题是我在游戏循环中这样做,并且已知文本会一遍又一遍地出现和消失,有什么明智的方法吗以某种方式绕过它? 提前致谢

def settings_show():
        draw_text('CONTROL:', font, WHITE, 115, 380),
        draw_text('JUMP', font, WHITE, 190, 410),
        screen.blit(Wkey, (140, 395)),
        draw_text('LEFT', font, WHITE, 55, 450),
        screen.blit(Dkey, (180, 435)),
        draw_text('RIGHT', font, WHITE, 230, 450),
        screen.blit(Akey, (100, 435)),
        draw_text('SHOOT', font, WHITE, 210, 490),
        screen.blit(SPkey, (125, 460)),
        draw_text('NADE', font, WHITE, 55, 546),
        screen.blit(Qkey, (5, 530)),
        draw_text('MUTE MUSIC', font, WHITE, 55, 586),
        screen.blit(Mkey, (5, 570)),
        draw_text('UNMUTE MUSIC', font, WHITE, 55, 626),
        screen.blit(Ukey, (5, 610)),
        draw_text('FULLSCREEN', font, WHITE, 55, 666),
        screen.blit(Fkey, (5, 650)),
        draw_text('TAKE SCREENSHOT', font, WHITE, 55, 706),
        screen.blit(F5key, (5, 690)),
        draw_text('EXIT', font, WHITE, 55, 746),
        screen.blit(ESCkey, (5, 730))
settings_button = button.Button(SCREEN_WIDTH // 1 - 1050, SCREEN_HEIGHT // 1 - 70, settings_img, 1)
        if start_button.draw(screen):
            start_game = True
            MENUSELECT.play()
            pygame.mixer.music.stop()
        if exit_button.draw(screen):
            MENUSELECT.play()
            run = False
            pygame.display.update()
        if settings_button.draw(screen):
            MENUSELECT.play()
            settings_show()

您必须在应用程序循环中调用 settings_show()。而不是在按下按钮时调用 settings_show(),而是设置一个指示必须显示设置的状态:

game_state = "start_menu"

# application loop
while run:
    # [...]

    if game_state == "start_menu":
        if start_button.draw(screen):
            start_game = True
            MENUSELECT.play()
            pygame.mixer.music.stop()
        if exit_button.draw(screen):
            MENUSELECT.play()
            run = False
        if settings_button.draw(screen):
            MENUSELECT.play()
            game_state = "settings"


    elif game_state == "settings":
        settings_show()