import tkinter as tk
import pyttsx3
from tkinter import messagebox
engine = pyttsx3.init()
root = tk.Tk()
root.geometry("500x250")
randText = tk.Label(root, text="Type anything below").pack()
text2turn = tk.Text(root, height=100, width=200)
text2turn.tag_configure("center", justify='center')
text2turn.pack()
def sayText():
text = text2turn.get(1.0, 'end-1c')
if text == "":
messagebox.showwarning("Error", "Please enter some text, I cannot say nothing")
else:
engine.say(text)
engine.runAndWait()
submit = tk.Button(root, text="Say My Text!", command=sayText)
submit.place(x=215, y=200)
root.mainloop()