1

I'm creating Wordle in Python, and I'm running into a strange error.

entry_box = tk.Entry(root)
entry_box.pack()

This is the entry box. It's where the player inputs their word.

def play_again():
    global WORDS
    global WORD
    WORD = WORDS[random.randint(0, len(WORDS)-1)]
    for ltr in ltrs:
        ltr.destroy()
    entry_box.pack()
    submit.pack()
    replay.destroy()
    correct_answer.destroy()
    
replay = tk.Button(root, text="PLAY AGAIN", command=play_again)

This is the replay button and what it does.

if times_played == 6:
        correct_answer.pack()
        submit.destroy()
        entry_box.destroy()
        replay.pack()

This is one of the places where it is packed.

The problem is that when it is clicked, the error _tkinter.TclError: bad window path name ".!entry" shows up on my terminal, and the play_again() function does everything it should up to where it says "entry_box.pack()". I've researched this error and found it to be caused mainly by the widget the item is attached to is nonexistent or not declared. However, mine is. Any ideas as to why it's not working?

0 Answers0