复制就行
不多逼逼
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=&