Every time I'm getting this error:
_tkinter.TclError: image "pyimage2" doesn't exist
When I want to execute this code:
self.frame1 = customtkinter.CTkFrame(self)
self.frame1.pack(fill="both", padx=20, pady=20)
book_image = customtkinter.CTkImage(Image.open(self.thumbnail_path))
image_label = customtkinter.CTkLabel(self.frame1, image=book_image, text="")
image_label.pack(side=customtkinter.LEFT, padx=10, pady=10)
The path is here:
self.filename = f"{random.randint(10000, 100000)}.png"
self.thumbnail_path = os.path.join(cache_dir, self.filename)
self.cache_file = os.path.join(cache_dir, self.filename)
if not os.path.exists(self.cache_file):
urllib.request.urlretrieve(self.thumbnail, self.cache_file)
The image should be placed in a CTkToplevel (via a class) which is called by the root window. If it's helpful(?); I'm using a Mac
To add to acw1668's comment, the error could be caused by running more than one instance of Tk.
Also have a look at these questions image-pyimage2-doesnt-exist and tkinter-tclerror-image-pyimage3-doesnt-exist. They seem to have a similar problem.
If this is the case the issue is most likely solved by running one instance as Toplevel()
instead of Tk()
If that doesn't solve the problem, we would need to see more of your implementation so we can reproduce the issue.