''
当别人打开这个程序时,其电脑桌面会变成恐怖图片,并播放恐怖音乐
''
'
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)