Python Forum

Full Version: GUIZERO andnfrom threading import Thread import pyttsx3 engine = pyttsx3.inithreading
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
from threading import Thread
import pyttsx3
engine = pyttsx3.init()
from guizero import App, TextBox, PushButton, Text, alerts,Slider
from tkinter.font import Font

def voice_speed(slider_value):
    r=slider_value
    print(r)

def voice_volume(slider_value):
    v=slider_value
    print(v)

def go():
    while True:
        #print(slider_r.value)
        print(slider_v.value)
        engine.setProperty('rate',slider_r.value)
        engine.setProperty('volume',slider_v.value)
        engine.say(textbox.value)
        engine.runAndWait()

app = App()
slider_r = Slider(app, command=voice_speed)
slider_v = Slider(app, command=voice_volume)

text = Text(app, text="Enter your name")
textbox = TextBox(app)
button = PushButton(app, text="Start", command=go)
app.display()
I am trying to create a simple GUI app to convert text to speech. I don't have clear knowledge on parallel programming or threading in pythonn. So please help me to achieve my goal.
Here i want to start and stop voice play by pressing a push button and vary the volume and word rate by scroll bar.