PC语音识别GUI设计(接上篇)

本文继续上篇,深入探讨如何在PC上设计并实现一个基于语音识别的图形用户界面(GUI)。利用人工智能和Python技术,创建了一个高效且用户友好的语音交互系统。
摘要由CSDN通过智能技术生成

复制就行

不多逼逼

import tkinter as tk
from tkinter import *
from tkinter import messagebox
import os
import codecs

# 检查并创建命令文件
key_file = "./API_KEY.txt"
def order_file():
    if not os.path.exists(key_file):
        with codecs.open(key_file, 'a+', encoding='utf-8') as f:
            f.write("")
# 检查并创建热键
button_file = "./button_KEY.txt"
def button():
    if not os.path.exists(button_file):
        with codecs.open(button_file, 'a+', encoding='utf-8') as f:
            f.write("")
# 执行
order_file()
button()
# 运行标识

hf = {'hf1':1,'hf2':1,'hf3':1,'hf4':1}
# 主窗口函数
def window_0():
    #退出主窗口函数
    def close():
        window_0.destroy()

    # 主窗口创建
    window_0 = tk.Tk()
    # 窗口大小
    window_0.geometry('450x280+450+200')
    # 设置GUI标题
    window_0.title('PC语音助手')
    # 设置GUI透明度(0.0~1.0)
    window_0.wm_attributes("-alpha", 1.0)
    # 设置为工具窗口(没有放大和缩小按钮)
    window_0.wm_attributes("-toolwindow", True)
    # 设置GUI置顶
    # window.wm_attributes("-topmost", True)
    # 去除GUI边框(GUI标题、放大缩小和关闭按钮都会消失)
    # window.overrideredirect(-1)
    # 图片
    photo = tk.PhotoImage(file=r".\fox.gif")
    imgLabel = tk.Label(window_0, image=photo)
    imgLabel.pack(side=tk.RIGHT)
    welcome_word_1 = tk.Label(text="欢迎使用", font=("黑体", 25)).pack(
        side="top")
    welcome_word_2 = tk.Label(text="—02.2.7版",
                              font=("黑体", 12)).pack(
        side="top")
    line_1 = tk.Label(text="--------------------",
                      font=("黑体", 12)).pack(side="top")
    # 主窗口按键布局

    button_01 = tk.Button(window_0, text='语音|地址设置', font=("黑体", 15),
                          bg="#f5f5f5", fg="#000000",
                          width=15, command=win_1).pack(side="top")
    linell1 = tk.Label(text="     ",
                      font=("黑体", 1)).pack(side="top")
    button_02 = tk.Button(window_0, text='API更新', font=("黑体", 15),
                          bg="#f5f5f5", fg="#000000",
                          width=15, command=win_2).pack(side="top")
    linell2 = tk.Label(text=&
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值