猫史档案馆


【Python作品分享】整蛊朋友【作品秀】

用户:自力更生自力更生查看:0 回复:2 评论:0 创建时间:2021-01-10T21:58:39


【作品展示】

center_image

 

【作品介绍】

病毒式整蛊朋友

 

【作品源代码】

import tkinter as tk
import random
import threading
import time


def dow():
    window = tk.Tk()
    window.title('你是憨憨')
    window.geometry("200x50" + "+" + str(random.randrange(0, window.winfo_screenwidth())
                                         ) + "+" + str(random.randrange(0, window.winfo_screenheight())))
    tk.Label(window,
             text='你是个铁憨憨!',  # 标签的文字
             bg='Red',  # 背景颜色
             font=('楷体', 17),  # 字体和字体大小
             width=20, height=2  # 标签长宽
             ).pack()  # 固定窗口位置
    window.mainloop()


threads = []
# while True:  #这句为喵循环,无限弹窗
for i in range(100):  # 需要的弹框数量
    t = threading.Thread(target=dow)
    threads.append(t)
    time.sleep(0.1)
    threads[i].start()

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 1下一页
MC_RIP2MC_RIP2

强...

点赞0


评论


冒泡的可口可乐冒泡的可口可乐

emotion_编程猫_搓头

点赞0


评论