I wrote the program at the end of the question to download an art work image from https://thisartworkdoesnotexist.com and then save it in a jpg file and then set that jpg as wallpaper. After this, I wrapped it up into a tkinter gui. This program works as I have expected when clicking the button but the wallpaper does not remain after restart. It shows a black screen as wallpaper instead. I am posting the whole code because I can't understand what the problem is and can't guess where the problem is.
import shutil
import ctypes
from tkinter import *
from tkinter.ttk import *
import requests
import os
print('imported')
working_dir = 'C:\\art-wall'
def magic():
download()
ctypes.windll.user32.SystemParametersInfoW(20, 0,'C:\\art-wall\\file.jpg' , 0)
print('magic')
def download():
url = 'https://thisartworkdoesnotexist.com/'
shutil.rmtree(working_dir)
os.mkdir(working_dir)
content = requests.get(url).content
open('C:\\art-wall\\file.jpg', 'wb').write(content)
print('download')
root = Tk()
root.geometry('500x500')
style = Style()
style.configure('TButton', font=
('calibri', 20, 'bold'),
borderwidth='4')
style.map('TButton')
btn1 = Button(root, text='Quit !', command=root.destroy)
btn1.grid(row=0, column=3, padx=100)
btn2 = Button(root, text='Change Wallpaper', command=magic)
btn2.grid(row=1, column=3, pady=10, padx=100)
root.mainloop()
Thanks in advance.