DEV Community

Cover image for Best Messagebox features in python
Kaveh Sabouri
Kaveh Sabouri

Posted on • Updated on

Best Messagebox features in python

Features we want teach you on this post:

  • Show warning
  • Show error
  • Ask cancel
  • Ask yes no
  • Ask retry cancel

1.Show warning

from tkinter import *
from tkinter import messagebox
window = Tk()
messagebox.showwarning("Warning","Warning")  
window.mainloop()
Enter fullscreen mode Exit fullscreen mode

output:

Image description

2.Show error

from tkinter import *
from tkinter import messagebox
window = Tk()
messagebox.showerror("Error","Error")  
window.mainloop()
Enter fullscreen mode Exit fullscreen mode

output:

Image description

3.Ask cancel

from tkinter import *
from tkinter import messagebox
window = Tk()
messagebox.askokcancel("askokcancel","askokcancel")  
window.mainloop()
Enter fullscreen mode Exit fullscreen mode

output:

Image description

4.Ask yes no

from tkinter import *
from tkinter import messagebox
window = Tk()
messagebox.askyesno("askyesno","askyesno")  
window.mainloop()
Enter fullscreen mode Exit fullscreen mode

output:

Image description

5.Ask retry cancel

from tkinter import *
from tkinter import messagebox
window = Tk()
messagebox.askretrycancel("askretrycancel","askretrycancel")  
window.mainloop()
Enter fullscreen mode Exit fullscreen mode

output:

Image description

1.Like
2.Comment
3.Follow me

Top comments (0)