Exemplo n.º 1
0
def Options_Menu(saveIndex=-1):
    options = [
        "Multiple Choice", "Fill in The Blanks", "Ordering", "True and False",
        "Standard", "Connecting"
    ]
    option_buttons = []
    option_buttons.append(Button((0, HEIGHT - 50, 175, 50), text="Back"))
    for b in range(len(options)):
        option_buttons.append(
            Button([WIDTH / 2 - 175 / 2, b * (50 + 25) + 100, 175, 50],
                   text=options[b],
                   fontSize=18))
    options = Screen((WIDTH, HEIGHT), "Options", 25, option_buttons, BGCOLOR)
    mp = 0, 0
    while True:
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                return "EXIT"
            if event.type == pygame.MOUSEMOTION:
                mp = pygame.mouse.get_pos()
                for button in options.buttons:
                    button.isOver(mp)
            if event.type == pygame.MOUSEBUTTONDOWN:
                for button in options.buttons:
                    if button.isOver(mp):
                        response = button.text
                        if response == "Multiple Choice":
                            qstn = QuestionTypes.MC("", ["", ""])
                            layout = Layouts.MultipleChoiceLayout(
                                qstn, defaultRect.copy())
                        elif response == "Fill in The Blanks":
                            qstn = QuestionTypes.FITB("")
                            layout = Layouts.FITBQuestionLayout(
                                qstn, defaultRect.copy())
                        elif response == "Ordering":
                            qstn = QuestionTypes.Ordering("", ["", ""])
                            layout = Layouts.OrderingLayout(
                                qstn, defaultRect.copy())
                        elif response == "True and False":
                            qstn = QuestionTypes.True_False("")
                            layout = Layouts.TrueFalseLayout(
                                qstn, defaultRect.copy())
                        elif response == "Standard":
                            qstn = QuestionTypes.Normal("")
                            layout = Layouts.NormalQuestionLayout(
                                qstn, defaultRect.copy())
                        elif response == "Connecting":
                            qstn = QuestionTypes.Connecting(
                                "", ["", ""], ["", ""])
                            layout = Layouts.ConnectingQuestionLayout(
                                qstn, defaultRect.copy())
                        elif response == "Back":
                            return "Menu"
                        response = Question_Editor(layout, saveIndex)
                        return response

        options.draw(screen)
        pygame.display.flip()