interactive program,pyTTS & Tk

Joined
Sep 24, 2006
Messages
1
Reaction score
0
Hi i have created 4 buttons using Tk what i want is when i press lets say button 1 you here "hello molly" this is my code so far.
from Tkinter import *
import pyTTS
class MyApp:
def __init__(self, parent):
self.myContainer1 = Frame(parent)
self.myContainer1.pack()

self.button1 = Button(self.myContainer1)
self.button1 ["text"] = "Hi Molly!" ### (1)
self.button1["background"] = "green" ### (1)
tts = pyTTS.Create()
tts.Speak ('hello molly')
self.button1.pack()

self.button2 = Button(self.myContainer1)
self.button2.configure(text="Connor!") ### (2)
self.button2.configure(background="tan") ### (2)
self.button2.pack()


self.button3 = Button(self.myContainer1)
self.button3.configure(text="Nige", background="cyan") ### (3)
self.button3.pack()

self.button4 = Button(self.myContainer1, text="Carmel!", background="red") ### (4)
self.button4.pack()
def button1Click(self, event): ### (3)
tts = pyTTS.Create()
if self.button1:
self.button1["background"] = "yellow"
tts.Speak('Hello Molly.') ### (4)
else:
self.button1["background"] = "green"
root = Tk()
myapp = MyApp(root)
root.mainloop()

#can anybody give me some guidance on this please.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,783
Latest member
RickeyDort

Latest Threads

Top