如何用python制作会动的壁纸?求大神赐教![抱拳] - 爱问答

(爱问答)

如何用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,())


可以看教程

可以找个视频教程一点点模仿

相关标签:大神

下一篇:初学ansys14.0,按照书上的步骤做的,到求解时却出现了这个,求解。。。。

上一篇:加密数据怎么替换

热门标签:
excel 网盘 破解 word dll
最新更新:
微软重新评估新的Outlook的使用时机 联想推出搭载联发科Helio G80芯片组的Tab M9平板 英特尔创新大赛时间确定! 微软Edge浏览器在稳定渠道中推出Workspaces功能 英伟达RTX4060TiGPU推出MaxSun动漫主题! 谷歌地图为用户提供了街景服务! GameSir 在T4 Kaleid中推出了一款出色的控制器! 微软开始在Windows 11 中测试其画图应用程序的新深色模式! LG电子推出全球首款无线OLED电视 英伟达人工智能芯片崭露头角! Steam Deck可以玩什么游戏-Steam Deck价格限时优惠 雷蛇推出CobraPro鼠标 Kindle电子阅读器可以访问谷歌商店吗 Windows10如何加入组策略 window10图片查看器怎么没有了?