import tkinter as tk
import random
root = tk.Tk()
root.attributes('-alpha', 0)
message = "cnmsb"
def create_popup():
x = random.randint(0, root.winfo_screenwidth())
y = random.randint(0, root.winfo_screenheight())
popup = tk.Toplevel(root)
popup.geometry("300x100")
popup.title("表白弹框")
popup.geometry(f"+{x}+{y}")
popup.configure(bg='pink')
label = tk.Label(popup, text=message, font=("Helvetica", 20), bg='pink')
label.pack(expand=True, fill="both")
root.after(10000, popup.destroy)
popup.attributes('-topmost', True)
def create_popup_with_delay():
create_popup()
root.after(1000, create_popup_with_delay)
create_popup_with_delay()
root.mainloop()