猫史档案馆


【python】一个小的恶搞程序

用户:煤黑烧饼煤黑烧饼查看:0 回复:2 评论:0 创建时间:2020-04-10T13:17:13


有依赖库,这是安装命令:

pip install pynput

这个程序不会对电脑造成任何损害,一点也没有!

终止程序或者重启即可解决

会弹出巨量恶搞的窗口,强制锁定音量100并播放《天空之城》,还会有关不掉的弹窗和七彩“Error”斑块覆盖屏幕

想看壮观场面的请耐心等待

import tkinter as tk
import tkinter.messagebox
from pynput import keyboard
import random
import threading
import time
from winsound import Beep
from pynput.mouse import Button, Controller
mouse = Controller()
keyboardController=keyboard.Controller()
def po():
    while True:
        mouse.move(random.randint(-5,5),random.randint(-5,5))
        time.sleep(0.01)
        keyboardController.press(keyboard.Key.media_volume_up)
def sound():
    Beep(880,250)

    Beep(988,250)

    Beep(523*2,600)

    Beep(988,300)

    Beep(523*2,600)

    Beep(659*2,600)

    Beep(988,1000)

    Beep(659,250)

    Beep(659,250)

    Beep(880,600)

    Beep(784,300)

    Beep(880,600)

    Beep(523*2,600)

    Beep(784,1000)
    
    Beep(659,600)

    Beep(698,800)

    Beep(659,300)

    Beep(698,600)

    Beep(523*2,600)

    Beep(659,980)

    Beep(523*2,250)

    Beep(523*2,250)

    Beep(523*2,250)

    Beep(988,600)

    Beep(739,300)

    Beep(739,600)

    Beep(988,600)

    Beep(988,1000)
    
    Beep(880,250)

    Beep(988,250)

    Beep(523*2,600)

    Beep(988,300)

    Beep(523*2,600)

    Beep(659*2,600)

    Beep(988,1000)

    Beep(659,250)

    Beep(659,250)

    Beep(880,600)

    Beep(784,300)

    Beep(880,600)

    Beep(523*2,600)

    Beep(784,1000)
    
    Beep(659,600)

    Beep(698,800)

    Beep(659,300)

    Beep(698,600)

    Beep(523*2,600)

    Beep(659,980)

    Beep(523*2,250)

    Beep(523*2,250)

    Beep(523*2,250)

    Beep(988,600)

    Beep(739,300)

    Beep(739,600)

    Beep(988,600)

    Beep(988,1000)
    #天空之城
def autoBeep():
    while True:
        print(66)
        sound()
def dow(p):
    window = tk.Tk()
    width=window.winfo_screenwidth()-200
    height=window.winfo_screenheight()-75
    a=random.randrange(0,width)
    b=random.randrange(0,height)
    window.attributes("-toolwindow", True)
    window.attributes("-topmost", True)
    window.overrideredirect(True)
    window.attributes("-alpha", 0.7)
    window.title('◐▦↘◲◩')
    window.geometry("200x50"+"+"+str(a)+"+"+str(b))
    tk.Label(window,
        text='Error',    # 标签的文字
        bg=random.choice(['Red','yellow','blue','Cyan','Magenta','Green']),     # 背景颜色
        font=('黑体', 17),     # 字体和字体大小
        width=15, height=2,  # 标签长宽
        fg="fireBrick"
        ).pack()    # 固定窗口位置
    window.mainloop()
def tdow(p):
    window = tk.Tk()
    width=window.winfo_screenwidth()-200
    height=window.winfo_screenheight()-75
    a=random.randrange(0,width)
    b=random.randrange(0,height)
    window.attributes("-toolwindow", True)
    window.attributes("-topmost", True)
    window.title('讣告')
    window.geometry("200x50"+"+"+str(a)+"+"+str(b))
    tk.Label(window,
        text='你还剩0秒',    # 标签的文字
        bg='fireBrick',     # 背景颜色
        font=('宋体', 17),     # 字体和字体大小
        width=15, height=2,  # 标签长宽
        fg="GhostWhite"
        ).pack()    # 固定窗口位置
    window.mainloop()
tss=threading.Thread(target=po)
ty=threading.Thread(target=autoBeep)
ty.start()
tss.start()
threadss = []
for i in range(random.randint(18,30)):#需要的弹框数量
    t = threading.Thread(target=lambda: tdow(i))
    threadss.append(t)
    time.sleep(0.1)
    threadss[i].start()
time.sleep(random.randint(10,20))
threads = []
for i in range(random.randint(20,35)):#需要的弹框数量
    t = threading.Thread(target=lambda: dow(i))
    threads.append(t)
    time.sleep(random.randint(1,5))
    threads[i].start()
while True:
    tkinter.messagebox.showerror(title='错误',message='看看你身后.')


回复

上一页1 页 / 共 1下一页
煤黑烧饼煤黑烧饼

只能在windows电脑上运行

点赞0


评论


TobylaiTobylai

…轻松停止

点赞0


评论