前言
今天,我们来做两个可以装逼的代码。
一、黑客帝国
做这个需要有pygame库。
首先导入库
import random import pygame
讯享网
代码部分:
讯享网import random import pygame PANEL_width = 600 PANEL_highly = 500 FONT_PX = 15 pygame.init() winSur = pygame.display.set_mode((PANEL_width, PANEL_highly)) font = pygame.font.SysFont("123.ttf", 25) bg_suface = pygame.Surface((PANEL_width, PANEL_highly), flags=pygame.SRCALPHA) pygame.Surface.convert(bg_suface) bg_suface.fill(pygame.Color(0, 0, 0, 28)) winSur.fill((0, 0, 0)) letter = ['q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'z', 'x', 'c', 'v', 'b', 'n', 'm'] texts = [ font.render(str(letter[i]), True, (0, 255, 0)) for i in range(26) ] column = int(PANEL_width / FONT_PX) drops = [0 for i in range(column)] while True: for event in pygame.event.get(): if event.type == pygame.QUIT: exit() elif event.type == pygame.KEYDOWN: chang = pygame.key.get_pressed() if(chang[32]): exit() pygame.time.delay(30) winSur.blit(bg_suface, (0, 0)) for i in range(len(drops)): text = random.choice(texts) winSur.blit(text, (i * FONT_PX, drops[i] * FONT_PX)) drops[i] += 1 if drops[i] * 10 > PANEL_highly or random.random() > 0.95: drops[i] = 0 pygame.display.flip()
二、病毒弹窗
import tkinter as tk import random import threading import time 代码: import tkinter as tk import random import threading import time color = ['red', '#356F9F'] color1 = random.choices(color) 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('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=dow) threads.append(t) time.sleep(0.0000000000000000000001) threads[i].start()

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/117361.html