
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()
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44