猫史档案馆


【Python作品分享】练习【作品秀】

用户:AndrewZXHqAndrewZXHq查看:0 回复:0 评论:0 创建时间:2022-11-18T20:11:01


【作品展示】

center_image

 

【作品介绍】

有任何问题,作者概不负责

 

【作品源代码】

import tkinter as tk
import random
import threading
import time


def dow():
    window = tk.Tk()
    width = window.winfo_screenwidth()
    height = window.winfo_screenheight()
    a = random.randrange(0, width)
    b = random.randrange(0, height)
    window.title('警告')
    window.geometry("380x80" + "+" + str(a) + "+" + str(b))
    tk.Label(window,
             text='检测到未知病毒',
             bg='red',
             font=('楷体', 16),
             width=60, height=4
             ).pack()
    window.mainloop()


threads = []
for i in range(50): #数字可以修改
    t = threading.Thread(target=dow)
    threads.append(t)
    time.sleep(0.1)
    threads[i].start()

 

【提示】

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

https://python.codemao.cn


回复

上一页1 页 / 共 0下一页