How can I make selectable game menu options using turtle?

  python-3.x

Total noob here. I’ve been following this course in udemy and got this snake game done, but now I want to add some stuff that the course skips. I’d like to have a start menu where I can select various options where I can start the game, select difficulty, select map size, maybe add sound and an option to mute it down the road, etc. I think this can be done using an if statement. But how would I be able to draw some sort of select box which lets you choose and only if you press "Enter" or some other key, the option will be selected. Here’s a slice of the code which I have in mind:

    from turtle import Turtle

    ALIGNMENT = "center"
    FONT = ("Courier", 18, "bold")

    class GameMenu(Turtle):
        
        def __init__(self):
            super().__init__()
            self.goto(0, 0)
            self.hideturtle()
            self.pencolor("white")

        def menu(self):
            self.write(f"Welcome to Nokia Snake", align=ALIGNMENT, font=FONT)

        def select_option(self):
            self.write(f"Start Game", align=ALIGNMENT, font=FONT)

Source: Python-3x Questions

LEAVE A COMMENT