import Tkinter as tk
import Image, time, datetime


def splash_screen():

    root = tk.Tk()

    root.overrideredirect(True)
    width = root.winfo_screenwidth()
    height = root.winfo_screenheight()
    root.geometry('%dx%d+%d+%d' % (width*0.8, height*0.8, width*0.1, height*0.1))

    image_file = "NHK.gif"
    image = tk.PhotoImage(file=image_file)
    canvas = tk.Canvas(root, height=height*0.8, width=width*0.8, bg="black")
    canvas.create_image(width*0.8/2, height*0.8/2, image=image)
    canvas.pack()

    
    root.after(10000, root.destroy)
    root.mainloop()
    return

splash_screen()

my_menu()# is defined at beginning of program

When I call the definition the picture NHK.GIF shows on a black background then disappears after 10 seconds.

The problem starts here; the program just stalls and nothing happens. Control is not given back to the main program ie, my menu doesn't print. When I hit close I get the message " The program is still running kill it? "

Please help I am very frustrated. I know the only problem in my code is in the splash_screen() Definition. Everything else runs flawlessly. The main purpose of this program is to teach basic survival skills.

Edited 5 Years Ago by Python Joe: n/a

Worked for me I just changed the name of image to one of minds and defind my_menu as simple print message. The message was printed OK.

Try replacing root.destroy with root.quit. Possibly the root window is destroyed but Tkinter is still running.

Try replacing root.destroy with root.quit. Possibly the root window is destroyed but Tkinter is still running.

OK, I tried that and it did make the program close, but a the black background did not disappear.

Ok, I looked at the example posted. I copied and pasted that one into a window, I get the same error. The Print statement never executes..

This article has been dead for over six months. Start a new discussion instead.