Reputation: 1
import from tkinter import *
import tkinter.simpledialog
import tkinter.messagebox
from tkinter import ttk
from time import strftime
now = strftime( "%x %Z %X")
root=Tk()
root.title("ON TOP OF THE WORLD")
canvas= Canvas(root, width=350, height=250)
canvas.pack()
photo=PhotoImage(file='/Users/m/Desktop/TOTW.gif')
canvas.create_image(0, 0, anchor = NW, image=photo)
tkinter.messagebox.showinfo("Hello,today is", now)
name=tkinter.simpledialog.askstring("name","What is your name?" )
output = "Hello, %s! May the only place you find yourself today is on top of the world !" %name
tkinter.messagebox.showinfo(now, output)
def on_closing():
if tkinter.messagebox.askokcancel("Quit", "Do you want to quit?"):
root.destroy()
root.protocol(on_closing)
root.mainloop()
Upvotes: 0
Views: 4803
Reputation: 61
You could take two other approaches to this, one being quit() and simply ending the code all together, or using frames in tkinter and calling a different frame whether it says close or comes up blank. It would be able to cover everything already there
Upvotes: 1