海!我试图使用以下代码访问我的图像:
import tkinter as tk
root = tk.Tk()
image = tk.PhotoImage(file="C:\\Users\*<mynamehere>*\\Documents\\Platformer")
label = tk.Label(image=image)
label.pack()
root.mainloop()
但我得到了标题中所述的错误。
出了什么问题,我该如何解决?有关未来加载图像的提示吗?
答案 0 :(得分:0)
在文件前加上“ r”以打开原始文件
image = tk.PhotoImage(file=r"C:\\Users\*<mynamehere>*\\Documents\\Platformer")