網站首頁 編程語言 正文
話不多說上代碼!源代碼
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
相關推薦
- 2022-11-21 go語言算法題解二叉樹的最小深度_Golang
- 2024-02-29 UNI-APP中點擊事件多重響應問題的解決,list列表項item和列表項item中按鈕的點擊事件沖
- 2024-03-07 做springboot-分模塊技術時新建立Maven模塊時報錯
- 2022-04-27 C語言陷阱與缺陷之數組越界訪問詳解_C 語言
- 2022-07-27 Android利用控制點的拖拽畫一個粽子_Android
- 2022-08-15 springboot項目搭建和基礎應用
- 2022-05-11 深入理解AQS之Semaphore&CountDownLatch&Cyclic詳解
- 2023-02-07 Pytorch中torch.argmax()函數使用及說明_python
- 最近更新
-
- 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同步修改后的遠程分支