網站首頁 編程語言 正文
話不多說上代碼!源代碼
from tkinter import * import pyttsx3 class Application(Frame): def __init__(self,master=None): super().__init__(master) self.master = master self.pack() self.creatWidget() # BING INPUT def creatWidget(self): self.w1 = Text(self, width=80, heigh=40, bg='lightcyan') # 寬度為80個字母(40個漢字),高度為1個行高 self.w1.pack() Button(self, text="轉語音", command=self.returnText).pack(side="left") # 返回信息 def returnText(self): # Indexes(索引):用來指向Text組件中文本的位置,Text的組件索引也是對應實際字符之間的位置 # 行號以1開始,列號以0開始 result=self.w1.get(1.0, END) # print("所有文本內容:\n", result) # messagebox.showinfo("所有的文本", self.w1.get(1.0, END)) engine = pyttsx3.init() engine.say(result) engine.runAndWait() if __name__ == '__main__': root = Tk() root.geometry("800x600+10+10") root.title("測試") app = Application(root) root.mainloop()
用來打包的文件
# -*- mode: python ; coding: utf-8 -*- block_cipher = None a = Analysis(['test.py'], pathex=[], binaries=[], datas=[], hiddenimports=[], hookspath=[], hooksconfig={}, runtime_hooks=[], excludes=[], win_no_prefer_redirects=False, win_private_assemblies=False, cipher=block_cipher, noarchive=False) pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher) exe = EXE(pyz, a.scripts, a.binaries, a.zipfiles, a.datas, [], name='test', debug=False, bootloader_ignore_signals=False, strip=False, upx=True, upx_exclude=[], runtime_tmpdir=None, console=True, disable_windowed_traceback=False, target_arch=None, codesign_identity=None, entitlements_file=None )
效果展示
原文鏈接:https://blog.csdn.net/lipeitong333/article/details/123493376
相關推薦
- 2024-01-13 Maven項目導入第三方jar包
- 2023-01-13 基于C#實現屏幕取色器_C#教程
- 2022-05-17 【go】解決“dial tcp 142.251.42.241:443: connect: conne
- 2022-10-30 Python利用Pandas進行數據分析的方法詳解_python
- 2022-09-08 pandas刪除部分數據后重新生成索引的實現_python
- 2023-01-17 Python使用鄰接矩陣實現圖及Dijkstra算法問題_python
- 2022-06-14 C#使用正則表達式_C#教程
- 2022-04-19 IDEA 快捷生成注釋 配置(完美不報警告)
- 最近更新
-
- window11 系統安裝 yarn
- 超詳細win安裝深度學習環境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權
- redisson分布式鎖中waittime的設
- maven:解決release錯誤:Artif
- restTemplate使用總結
- Spring Security之安全異常處理
- MybatisPlus優雅實現加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務發現-Nac
- Spring Security之基于HttpR
- Redis 底層數據結構-簡單動態字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支