如何用python制作会动的壁纸?求大神赐教![抱拳]
最近在网上学习python,看见能制作眼睛会动的大白,所以想知道用它做壁纸行不行。
用python写一个可以自动换壁纸
path="D:我的文档My Pictureswallpaper" #壁纸目录
newpath=os.path.join(os.getenv("appdata"),"MicrosoftWallpaper1.bmp")
Getwnd=FindWindow("Shell_TrayWnd",None)
screen_height0=GetSystemMetrics (win32con.SM_CYSCREEN)
screen_height=screen_height0-GetClientRect(Getwnd)[3]
screen_width=GetSystemMetrics (win32con.SM_CXSCREEN)
def change_wallpaper():
filelist=os.listdir(path)
ranpic=filelist[random.randint(0,len(filelist)-1)]
filefullpath="%s%s" % (path,ranpic)
im=Image.open(filefullpath)
if im.size[0] !=screen_width or im.size[1]!=screen_height0:return
im.save(newpath, "BMP")
windll.user32.SystemParametersInfoA(20, 0,newpath, 0)
def wallpaper_thread():
while 1:
change_wallpaper()
sleeptime=random.randint(15,30)*60
print sleeptime
time.sleep(sleeptime)
thread.start_new_thread(wallpaper_thread,())
可以看教程
可以找个视频教程一点点模仿