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.

Recommended Answers

All 6 Replies

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.

Is the splash screen supposed to be for a console program?

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..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.