當前位置:編程學習大全網 - 網站源碼 - 【python白問】用python改變桌面背景

【python白問】用python改變桌面背景

Path="D:\我的文檔\我的圖片\壁紙" #壁紙目錄

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(壁紙_線程,())

  • 上一篇:我想建立壹個購物網站
  • 下一篇:現在的電腦病毒基本上都是木馬嗎
  • copyright 2024編程學習大全網