r/pythonhelp • • 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

8 comments sorted by

View all comments

Show parent comment

1

u/Sea-Combination-2163 Feb 13 '25

Hi I tryed it like you suggested, but it dont change the wallpaper.

This is the Code:

import ctypes
import datetime
import time

night = datetime.time(16, 42, 0,)
rigthnow = datetime.datetime.now().time()

#the link for the normale wallpaper 


while True:
    if rigthnow > night:
        wallpaper = "night1"
        if wallpaper == "night1":
            #the link and all the things
            print("test")
            wallpaper = "day"
        elif wallpaper == "day":
            pass
    time.sleep(30)

and sorrry for that many questions, im just starting