Код: Выделить всё
def speak(message):
engine = pyttsx3.init()
voices = engine.getProperty('voices') # Get available voices
engine.setProperty('voice', voices[0].id) # Set the voice
engine.setProperty('rate', 200)
engine.say(message)
engine.runAndWait()
return "Your message was spoken!"
Код: Выделить всё
play_button = Button(bottom_label, text="Replay", font=FONT_BOLD, width=20, bg=BG_VIOLET,
command=lambda: speak(last_message))
play_button.place(relx=0.01, rely=0.008, relheight=0.06, relwidth=0.22)
Подробнее здесь: https://stackoverflow.com/questions/787 ... executable