Your application.
If you create a PhotoImage under a Tk instance, you will not be able to access it.
It comes from other instances.
To solve this problem, make sure to use only one Tk instance (created using Toplevel
New top-level window), or make sure that the
The same instance as the widget you will use in it. The simplest method
do
This is to pass the primary keyword parameter to the PhotoImage constructor:
Photo = photo image (..., master=myroot)
button = Button(myroot,...)
Button.photo = photo # Keep the reference.
PhotoImage objects can only be used under one thread. A thread has been started with TK () in the main module, and then a thread cannot be called in the sub-module. Therefore, instead of opening an auxiliary window, you can use frame or toplevel.
The above is a personal understanding, and the error is pointed out.