How to Get a Popup Dialog in Python Tkinter
Python course with 57 real-time projects - Learn Python
Program 1
from tkinter import * import tkinter.messagebox def btnClick(n): if(n==1): #choice=tkinter.messagebox.askyesnocancel("Exit Window","Are you Sure want to exit...") #print(choice) choice = tkinter.messagebox.askokcancel("Exit Window", "Are you Sure want to exit...") if(choice==True): myroot.destroy() elif(n==2): tkinter.messagebox.showinfo("window","Record save successfully") tkinter.messagebox.showerror("window", "Record Not save Error") tkinter.messagebox.showwarning("window", "Record Not save Error") tkinter.messagebox.askquestion("question","This is Question") myroot=Tk() myroot.geometry('600x600') myroot.title("Message Window Application") myroot.wm_iconbitmap('2.ico') myroot.maxsize(600,600) myroot.minsize(600,600) fm=Frame(myroot,width=600,height=600,bg='yellow') fm.pack() fm.propagate(0) btnexit=Button(fm,text="Exit",font=('Arial,10,bold'),command=lambda :btnClick(1)) btnsave=Button(fm,text="Save",font=('Arial,10,bold'),command=lambda :btnClick(2)) btnsearch=Button(fm,text="Search",font=('Arial,10,bold'),command=lambda :btnClick(3)) btnexit.pack() btnsave.pack() btnsearch.pack() myroot.mainloop()
We work very hard to provide you quality material
Could you take 15 seconds and share your happy experience on Google