new path = OS . path . join(OS . getenv(" appdata ")," Microsoft\Wallpaper1.bmp ")
getwnd = FindWindow(" Shell _ tray wnd ",無)
screen _ height 0 = GetSystemMetrics(win32 con。SM_CYSCREEN)
screen _ height = screen _ height 0-GetClientRect(Getwnd)[3]
screen _ width = GetSystemMetrics(win32 con。SM_CXSCREEN)
def change _壁紙():
filelist=os.listdir(路徑)
ran pic = file list[random . randint(0,len(filelist)-1)]
filefullpath="%s\%s" % (path,ranpic)
im=Image.open(filefullpath)
if im.size[0]!=screen_width或im.size[1]!=screen_height0:return
im.save(newpath,“BMP”)
windll . user 32 . system parameters sinfoa(20,0,newpath,0)
def壁紙_線程():
而1:
更改壁紙()
sleep time = random . randint(15,30)*60
打印睡眠時間
睡眠時間
thread.start_new_thread(壁紙_線程,())