R
Rob Williscroft
Nigel wrote in in comp.lang.python:
Your problem appears to be that you do not know how to associate
an action (the press of the button) with the code you want to run
( tts.Speak ('hello molly') ).
Tk buttions have a command attribute that is called when the button
is clicked:
self.button1[ 'command' ] = HelloMolly
Where HelloMolly is an already defined python callable, for example:
def HelloMolly():
self.tts.Speak ('hello molly')
The above defenition of HelloMolly requires that somtime before it
is called, self.tts is created:
self.tts = pyTTS.Create()
HTH.
Rob.
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.
Your problem appears to be that you do not know how to associate
an action (the press of the button) with the code you want to run
( tts.Speak ('hello molly') ).
Tk buttions have a command attribute that is called when the button
is clicked:
self.button1[ 'command' ] = HelloMolly
Where HelloMolly is an already defined python callable, for example:
def HelloMolly():
self.tts.Speak ('hello molly')
The above defenition of HelloMolly requires that somtime before it
is called, self.tts is created:
self.tts = pyTTS.Create()
HTH.
Rob.