# coding:utf-8
import tkinter as tk
from random import random
from tkinter import messagebox
root = tk.Tk()
root.geometry('500x300+1000+500')
root.title('辞职信')
frame1 = tk.Frame(root)
frame1.pack()
tk.Label(frame1, text='尊敬的各位领导:', font=24, padx=30, pady=30).pack(side=tk.LEFT, anchor=tk.N)
# img = tk.PhotoImage(file=r'logo.png')
# img_label = tk.Label(frame1, image=img, padx=30, pady=30, bg='0')
# img_label.pack(side=tk.LEFT, anchor=tk.N)
tk.Label(frame1, text='辞职人:黄某', height=25, font=24, anchor=tk.S).pack(side=tk.LEFT)
yes_btn = tk.Button(frame1, text='同意', fg='green')
no_btn = tk.Button(frame1, text='不同意', fg='red')
yes_btn.place(relx=0.3, rely=0.8, anchor=tk.CENTER)
no_btn.place(relx=0.7, rely=0.8, anchor=tk.CENTER)
frame2 = tk.Frame(root)
# frame2.pack()
tk.Label(frame2, text='老板大人,臣告退了\n这一退,可能就是一辈子了\n!!!!>()<!!!!',
font=('黑体', 18),
justify=tk.LEFT,
height=300,
fg='red',
padx=50).pack()
tk.Button(frame2, text='退出', command=root.quit).place(relx=0.9, rely=0.8)
def on_exit():
messagebox.showwarning(title='提示', message='此路不通')
root.protocol('WM_DELETE_WINDOW', on_exit)
def move(event):
no_btn.place(relx=random(), rely=random(), anchor=tk.CENTER)
no_btn.bind('<Enter>', move)
def sure():
frame1.pack_forget()
frame2.pack()
yes_btn.config(command=sure)
root.mainloop()
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构