from tkinter import *
import pyttsx3
root = Tk()
root.geometry("800x500")
def talk():
engine = pyttsx3.init()
engine.say(my_entry.get())
my_entry.delete(0, END)
engine.runAndWait()
my_entry = Entry(root, font=("Helvetica", 28))
my_entry.pack(pady=20)
my_button = Button(root, text="Speak", command=talk)
my_button.pack(pady=20)
root.mainloop()
I am trying to run this simple program but the window only runs once and closes automatically. The Tkinter window closes after only running one time. Any suggestions? Some people suggested threading but I don't know how to use it, if anyone of you knows where I can learn that, it will be helpful.