def check_answer_correct_double_dip(button_name: str, game: Game) -> None: if game.game_on and game.question_shown and not game.question_answered: letter = button_name[-1] answer_widget = get_widget(answers_localization + letter) confirm_final_answer(answer_widget) final_ans_sound = game.lifeline_themes[2] play(final_ans_sound) user_answer = answer_widget.get("1.0", "end-1c") if game.answer_correct(user_answer, game.current_question): gui.after(3900, lambda: green_answer(answers, answers_localization)) gui.after(4000, lambda: winning_sequence()) gui.after( 4000, lambda: change_button_image(ddip_localization, "doubledipused.png")) else: answer_text = get_widget(answers_localization + letter) gui.after(3900, lambda: first_wrong_answer(answer_text)) gui.after(4000, lambda: play(game.lifeline_themes[3])) f = check_answer_correct get_widget(buttons_localization + "A").config(command=lambda: f("button_A", game)) get_widget(buttons_localization + "B").config(command=lambda: f("button_B", game)) get_widget(buttons_localization + "C").config(command=lambda: f("button_C", game)) get_widget(buttons_localization + "D").config(command=lambda: f("button_D", game))
def verify_correct_answer(game: Game, user_answer: str, answers: List[str], localization: str) -> None: green_answer(answers, localization) if game.answer_correct(user_answer, game.current_question): winning_sequence() else: losing_sequence() game.question_answered = False game.question_shown = False