0

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 like 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!

Soda
  • 89
  • 1
  • 8

1 Answers1

0

Update: Solved:

It appears that another mainloop apart from root.mainloop() in combination with another window besides a toplevel, just crashes the code somehow.

I implemented a toplevel window as splash like suggested here: Tkinter Show splash screen and hide main screen until __init__ has finished

Thank you!

Soda
  • 89
  • 1
  • 8