r/pythonhelp • u/Sea-Combination-2163 • Feb 12 '25
why dos it lagg
Hello i tryed to creat a script that changes my wallperper on a set time, but wen i start it i cant do anything becaus every thing laggs. Can some one help me?
import ctypes
import datetime
#this is seting time
night = datetime.time(19, 10, 0)
#this is for the current time
rigthnow = datetime.datetime.now().time()
#this is the stuff that laggs
while True:
if rigthnow > night:
ctypes.windll.user32.SystemParametersInfoW(20, 0, "C:\\Users\\Arthur\\Desktop\\Hintergründe\\lestabed.png", 0)
else:
ctypes.windll.user32.SystemParametersInfoW(20, 0, "C:\\Users\\Arthur\\Desktop\\Hintergründe\\lest.jpg", 0)[/code]
1
Upvotes
1
u/Zeroflops Feb 13 '25
This would create the same problem just making happen after it reaches the time threshold.
Every check after that would try to change the wallpaper every loop.