Use bytestring for wallpaper path on Windows

This commit is contained in:
Gremious Grenald 2023-06-27 21:10:12 +01:00
parent 236aa48e74
commit 80fd0ff646
No known key found for this signature in database
GPG Key ID: 60CD7CB9E482989C

View File

@ -175,7 +175,10 @@ def set_win_wallpaper(img):
if "x86" in os.environ["PROGRAMFILES"]: if "x86" in os.environ["PROGRAMFILES"]:
ctypes.windll.user32.SystemParametersInfoW(20, 0, img, 3) ctypes.windll.user32.SystemParametersInfoW(20, 0, img, 3)
else: else:
ctypes.windll.user32.SystemParametersInfoA(20, 0, img, 3) # 'W' funcitons take uniqcode strings,
# while 'A' functions take UTF-8 bytestrings.
# (Python 3 strings are Unicode by default.)
ctypes.windll.user32.SystemParametersInfoA(20, 0, str.encode(img), 3)
def change(img): def change(img):