When implementing Splash Screen, pyimage doesn’t exist anymore

  python, tkinter

So, that’s one of the strangest errors I’ve ever seen in Python. Hopefully, you can help me.

I have a tkinter mainwindow in main_file implementing images via:

from PIL import Image, ImageTk, ImageColor

#...

self.image_package_render = Image.open('ImagePackage.png')
self.image_package_render_data = np.array(self.image_package_render.convert('RGBA'))

self.plus_render = ImageTk.PhotoImage(self.image_package_render.resize((14, 14), box=(16, 20, 30, 34)))

When I launch the main_file directly, it works without a charm via root.mainloop().

Now I want to implement a splash screen by developing an external script:

import tkinter as tk

splash_root = tk.Tk()
splash_root.geometry("200x200")
splash_label = tk.Label(splash_root, text="Splash Screen", font=18)
splash_label.pack()

import main_file

splash_root.destroy()
tk.mainloop()

Now, however, main_file doesn’t start up and throws me the error "_tkinter.TclError: image "pyimage12" doesn’t exist".

(Also doesn’t work, if I implement the splash_root directly in main_file).

It clearly has something to do with splash_root, but I can’t get my head around it.

Cheers guys!

Source: Python Questions

LEAVE A COMMENT