interactive programe-pyTTS &Tk

Nigel cm012b5105 at blueyonder.co.uk
Sun Sep 24 18:11:38 EDT 2006


from Tkinter import *
import pyTTS
Hi i am trying to get a button so that when i click on it i hear a voice say
"Hi Molly" this is my code so far.Can any one shed any light on this for
please.
Thanks Nige.

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()
#"""<tt060.py





More information about the Python-list mailing list