无码av一区二区三区无码,在线观看老湿视频福利,日韩经典三级片,成 人色 网 站 欧美大片在线观看

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

修改傻瓜閱讀軟件,顯示讀書內(nèi)容(I)

2020-03-29 11:46 作者:一心想當(dāng)網(wǎng)紅的李老師  | 我要投稿

修改了上次的傻瓜閱讀軟件。

import importlib,sys

importlib.reload(sys)


import tkinter

from tkinter.filedialog import askopenfilename

from docx import Document

from docx.shared import Inches

import pyttsx3

from tkinter import *

from tkinter import ttk

import os



l=[]

def openfile():

? ? global file_path

? ? file_path=askopenfilename() ??

? ? if os.path.splitext(str(file_path))[1]=='.txt': ?###對于TXT文件的處理

? ? ? ? f=open(file_path,encoding='utf-8')

? ? ? ? fread=f.read()

? ? ? ? f=str(fread)

? ? ? ? text.insert(END,f)

? ? ? ? engine=pyttsx3.init()

? ? ? ? engine.say(f)

? ? ? ? engine.runAndWait()

? ? elif os.path.splitext(str(file_path))[1]=='.docx': ###對于WORD文件處理

? ? ? ? f=Document(file_path)

? ? ? ? for para in f.paragraphs:

? ? ? ? ? ? l.append(para.text)

? ? ? ? text.insert(END,str(l))

? ? ? ? engine=pyttsx3.init()

? ? ? ? engine.say(str(l))

? ? ? ? engine.runAndWait()



if __name__=='__main__':

? ? root=Tk()

? ? root.title('讀書軟件')

? ? root.geometry("720x480")

? ? root.configure(bg="white")

? ? Button1=tkinter.Button(root, text ="選擇文件", command = openfile)

? ? Button1.grid(row=0,column=0,padx=20,pady=20)

? ? text=tkinter.Text(root,bg="yellow")

? ? text.grid(row=0,column=1,padx=20,pady=20) ??

? ? root.mainloop()


修改傻瓜閱讀軟件,顯示讀書內(nèi)容(I)的評論 (共 條)

分享到微博請遵守國家法律
香格里拉县| 靖江市| 南宁市| 平江县| 陆河县| 新宁县| 恩施市| 淄博市| 磐安县| 葵青区| 临高县| 汝南县| 怀宁县| 五台县| 博乐市| 新蔡县| 乌拉特后旗| 车险| 盐津县| 舞钢市| 巴彦淖尔市| 佛学| 昭通市| 六安市| 彩票| 惠州市| 陈巴尔虎旗| 南丰县| 台南市| 安阳县| 中超| 文登市| 五常市| 彰化县| 合肥市| 美姑县| 鄂尔多斯市| 黔江区| 且末县| 大城县| 南阳市|