python傻瓜式读书软件(文字转换语音改进)
2020-02-29 20:02 作者:一心想当网红的李老师 | 我要投稿
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import sys
reload(sys)
sys.setdefaultencoding('utf8')
import pyttsx
import Tkinter
from FileDialog import *
import tkFileDialog
def openfile():
filename=tkFile
Dialog.askopenfilename()
f=open(filename,'r')
fread=f.read()
f=str(fread)
engine=pyttsx.init()
engine.say(f)
engine.runAndWait()
top=Tkinter.Tk()
Button1=Tkinter.Button(top, text ="选择文件", command = openfile)
Button1.pack()
top.mainloop()
在上次的文字转换语音的基础上,做了一个交互界面,可以方便把文字读出来。
勉强算是个读书软件吧。