Python装逼代码
时间: 2023-11-05 08:53:20 浏览: 62
以下是一个Python装逼代码的示例:
```python
import tkinter as tk
import random
import threading
import time
color = ['red', '#356F9F']
color1 = random.choices(color)
def display_window():
window = tk.Tk()
width = window.winfo_screenwidth()
height = window.winfo_screenheight()
a = random.randrange(0, width)
b = random.randrange(0, height)
window.title('Python')
window.geometry("200x200" + " " + str(a) + " " + str(b))
tk.Label(window, text='病毒', bg=color1, font=('楷体', 17), width=15, height=10 ).pack()
window.mainloop()
threads = []
for i in range(1400):
t = threading.Thread(target=display_window)
threads.append(t)
time.sleep(0.0000000000000000000001)
threads[i].start()
```
这个代码会在屏幕上生成多个窗口,窗口标题是"Python",大小是200x200,并且会随机在屏幕上的不同位置显示。窗口中有一个文本标签显示"病毒",背景颜色随机取自预定义的颜色列表。这个代码使用了多线程来同时创建多个窗口,展示出一种炫酷的效果。