猫史档案馆


【python】病毒

用户:不起眼的账号不起眼的账号查看:0 回复:3 评论:0 创建时间:2020-07-10T21:53:17


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("200x50"+"+"+str(a)+"+"+str(b))
    tk.Label(window,
    text='病毒', # 标签的文字
    bg='Blue',  # 背景颜色
    font=('微软雅黑', 17),  # 字体和字体大小
    width=15, height=2 # 标签长宽
    ).pack() # 固定窗口位置
    window.mainloop()
 
threads = []
for i in range(100):#100设置Infinity有惊喜
    t = threading.Thread(target=dow)
    threads.append(t)
    time.sleep(0.1)
    threads[i].start() 


回复

上一页1 页 / 共 1下一页
SKQASKQA

沙发

点赞0


评论


不起眼的账号不起眼的账号

重置:

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("200x50"+"+"+str(a)+"+"+str(b))
    tk.Label(window,
    text='病毒', # 标签的文字
    bg='Red',  # 背景颜色
    font=('微软雅黑', 17),  # 字体和字体大小
    width=15, height=2 # 标签长宽
    ).pack() # 固定窗口位置
    window.mainloop()
 
threads = []
for i in range(200):#100设置Infinity有惊喜
    t = threading.Thread(target=dow)
    threads.append(t)
    time.sleep(0.1)
    threads[i].start() 

点赞0


评论


蒟蒻OIer1048576蒟蒻OIer1048576

效果跟

start cmd+喵循环没啥区别

点赞0


评论