用Python制作整蛊小程序

711次阅读
没有评论

用Python制作整蛊小程序

下面的整蛊程序,千万不要发代码,否则就实现不了你整蛊的目的了。完成后一定要打包成一个exe程序,再发给朋友使用 。

1. 使用  pip install pyinstaller

2.打包命令:

pyinstaller -F 文件名.py

一、猜我在干啥?

while True:  n = input("猜猜我在想啥?")  print("猜错喽")

启动程序后你的朋友将永远猜不出来你在干嘛。

二、恐怖桌面

启动后电脑桌面会变成恐怖图片,并播放恐怖音乐

''
    当别人打开这个程序时,其电脑桌面会变成恐怖图片,并播放恐怖音乐
'''
import time
import pygame

import win32api
import win32con
import win32gui

#线程模块
import threading


def go():
    pygame.mixer.init()
    while True:
        for i in range(1,5):
            filePath = r"E:\pycharm project\自动化办公和鼠标键盘模拟\p"+"\\"+str(i)+".mp3"

            track = pygame.mixer.music.load(filePath)
            pygame.mixer.music.play()
            time.sleep(30)
            pygame.mixer.music.stop()

def setWallpaper(path):
    reg_key = win32api.RegOpenKeyEx(win32con.HKEY_CURRENT_USER,"Control Panel\\Desktop",0,win32con.KEY_SET_VALUE)

    win32api.RegSetValueEx(reg_key, "WallpaperStyle", 0, win32con.REG_SZ, "2")

    win32gui.SystemParametersInfo(win32con.SPI_SETDESKWALLPAPER, path, win32con.SPIF_SENDWININICHANGE)


th = threading.Thread(target=go,name="loopTread")
th.start()
while True:
    for i in range(1,5):
        filePath = r"E:\pycharm project\自动化办公和鼠标键盘模拟\p"+"\\"+str(i)+".jpg"
        setWallpaper(filePath)
        time.sleep(4)

三、无限打开同一网站

调用默认浏览器,无限打开 python学习网 ,让他爱上学习。

import webbrowserwhile True:    webbrowser.open('www.python51.com')
神龙|纯净稳定代理IP免费测试>>>>>>>>天启|企业级代理IP免费测试>>>>>>>>IPIPGO|全球住宅代理IP免费测试

相关文章:

版权声明:wuyou2021-07-14发表,共计1289字。
新手QQ群:570568346,欢迎进群讨论 Python51学习