Our school device do not allow customer desktop setup nor software download, so I thought maybe I can write a desktop promgram myself.
I first convert gif/video into separate frams with name 0~(last frame) and stored in Frame directory, then using ctypes.windll.user32.SystemParametersInfoW to set each frame into desktop, and utilized sleep to manipulate the frame rate.
The prblem is that when the frame rate is too fast, or the image resolution is too high, the desktop will become laggy and consumes much of my RAM. Is there better way manipulate a animated desktop? Please tell ne, Thank you very much!
import os, ctypes
from time import sleep
frames = [int(x.split(".")[0]) for x in os.listdir(os.getcwd()+"/Frame")]
frames.sort()
counter = 0
while True:
desktop_frame = os.getcwd()+"/Frame/"+str(frames[counter])+".png"
sleep(1/5)
ctypes.windll.user32.SystemParametersInfoW(20, 0, desktop_frame, 0)
counter = counter + 1
if counter == len(frames):
counter = 0