赞
踩
目录
- import tkinter as tk
- from tkinter import ttk
- from PIL import Image, ImageTk
- import subprocess
- import sys
-
- def open_buy_quantity():
- window.destroy()
- subprocess.run(["python", "D:/桌面/python项目/软件使用公告.py"])
- sys.exit()
-
- def on_close():
- window.destroy()
-
- def maximize_window():
- window.attributes('-zoomed', True) # Maximize the window
-
-
- # 创建主窗口,并设置边框颜色和大小
- window = tk.Tk()
- window.title('抖音视频批量快删神器')
- window.config(bg='black', bd=1) # 设置窗口背景色为黑色,边框宽度为4
- window.overrideredirect(True) # 隐藏窗口边框
- window.geometry('500x400') # 设置窗口大小为固定值
-
- # 创建标题栏
- title_bar = tk.Frame(window, height=30, relief='raised', bg='pink') # 设置标题栏背景色为黑色
- title_bar.pack(fill='x', side='top')
-
- # 添加标题文本
- title_label = tk.Label(title_bar, text='抖音视频批量快删神器', font=('宋体', 12, 'bold'), bg='pink', fg='black') # 设置标题文本背景色为黑色,文本颜色为白色
- title_label.pack(side='left', padx=10)
-
- # 添加最小化按钮的自定义图标
- minimize_icon = Image.open('q.png') # 替换为你的最小化按钮图标路径
- minimize_icon = minimize_icon.resize((20, 20), Image.LANCZOS)
- minimize_photo = ImageTk.PhotoImage(minimize_icon)
-
- # 添加最大化按钮的自定义图标
- maximize_icon = Image.open('qq.png') # 替换为你的最大化按钮图标路径
- maximize_icon = maximize_icon.resize((20, 20), Image.LANCZOS)
- maximize_photo = ImageTk.PhotoImage(maximize_icon)
-
- # 添加关闭按钮的自定义图标
- close_icon = Image.open('qqq.png') # 替换为你的关闭按钮图标路径
- close_icon = close_icon.resize((20, 20), Image.LANCZOS)
- close_photo = ImageTk.PhotoImage(close_icon)
-
- # 添加最小化按钮
- minimize_button = ttk.Button(title_bar, image=minimize_photo, command=window.iconify, style='Toolbutton')
- minimize_button.pack(side='right', padx=5)
-
- # 添加最大化按钮
- maximize_button = ttk.Button(title_bar, image=maximize_photo, command=maximize_window, style='Toolbutton')
- maximize_button.pack(side='right', padx=5)
-
- # 添加关闭按钮
- close_button = ttk.Button(title_bar, image=close_photo, command=on_close, style='Toolbutton')
- close_button.pack(side='right', padx=5)
- # 定义鼠标按下事件,用于实现窗口拖动
- def on_mouse_down(event):
- global last_x, last_y
- last_x, last_y = event.x, event.y
-
- # 定义鼠标移动事件,用于实现窗口拖动
- def on_mouse_move(event):
- x, y = event.x_root - last_x, event.y_root - last_y
- window.geometry(f"+{x}+{y}")
-
- # 绑定鼠标按下和移动事件
- window.bind("<ButtonPress-1>", on_mouse_down)
- window.bind("<B1-Motion>", on_mouse_move)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。