저는 작은 파이썬 응용 프로그램이 있습니다.이 응용 프로그램은 일부 텍스트에 pyttsx를 사용합니다.이클립스 외부에서 실행될 때 프로그램이 완전히 작동하지 않습니다.
작동 방식 : 클립 보드에 무엇이 있더라도 간단히 말하면됩니다.
이클립스 내부 프로그램이 예상대로 작동합니다. 그러나 cmd.exe에서 실행하면 클립 보드의 텍스트가 너무 크면 (일부 paras) 부분적으로 만 작동합니다. 왜 ?
는 cmd를에서 실행하면 문을 출력하지만, 클립 보드의 텍스트가 여기에
실제로 이야기를 수행하는 프로그램 부분의 너무 큰 경우 실제는 (작동하지 않는 '이야기'할 수있는 볼 수있는 '이야기'부분은 스레드 내부에서 처리 할 수
def saythread(queue , text , pauselocation, startingPoint):
saythread.pauselocation = pauselocation
saythread.pause = 0
saythread.engine = pyttsx.init()
saythread.pausequeue1 = False
def onWord(name, location, length):
saythread.pausequeue1 = queue.get(False)
saythread.pause = location
saythread.pauselocation.append(location)
if saythread.pausequeue1 == True :
saythread.engine.stop()
def onFinishUtterance(name, completed):
if completed == True:
os._exit(0)
def engineRun():
if len(saythread.pauselocation) == 1:
rate = saythread.engine.getProperty('rate')
print rate
saythread.engine.setProperty('rate', rate-30)
textMod = text[startingPoint:]
saythread.engine.say(text[startingPoint:])
token = saythread.engine.connect("started-word" , onWord)
saythread.engine.connect("finished-utterance" , onFinishUtterance)
saythread.engine.startLoop(True)
engineRun()
if saythread.pausequeue1 == False:
os._exit(1)
def runNewThread(wordsToSay, startingPoint):
global queue, pauselocation
e1 = (queue, wordsToSay, pauselocation, startingPoint)
t1 = threading.Thread(target=saythread,args=e1)
t1.start()
#wordsToSay = CLIPBOARD CONTENTS
runNewThread(wordsToSay,0)
감사
을편집 :. 나도 같은 2.7이다 사용 파이썬 버전보다 확인하신 후 cmd를에서 프로그램을 실행하는 데 사용되는 명령을 사용합니다. : python d:\python\play\speech\speechplay.py
"러닝 파티"란 무엇을 의미합니까? 처리 된 클립 보드의 텍스트 일부입니까? 아니면 다른 것입니까? –
그것은 STDOUT에 텍스트를 출력하지만, 아무 것도 말하지 않습니다. –