Setting a desktop background with python ctypes library

I tried to make a PC app to change backgrounds on your desktop, but I ran into an issue and it doesn't work. I used python tkinter library. Help is much appreciated!

def addImage():
    pic = filedialog.askopenfile(initialdir="\n", title="Izberi sliko", 
        filetypes=(("JPEG", "*.jpeg"), ("PNG","*.png"), ("all files", "*.*")))
    SPI_SETDESKWALLPAPER = 20 
    ctypes.windll.user32.SystemParametersInfoA(SPI_SETDESKWALLPAPER, 0, pic.name, 0)


selectImage = tk.Button(root, text="Local image", padx=10, pady=5, fg="white", bg="#f6c1ff", command=addImage)
selectImage.pack()
How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum