How to show alerts in tkinter?

2.3k views Asked by At

I want to show alerts in tkinter in python. Is there anyone who can tell me how to show alerts?

2

There are 2 answers

0
Jean-Marc Volle On

You can use tkinter.messagebox to create a pop up that display an information, warning, or error

like:

tkinter.messagebox.showwarning(title = "Ooops",message = "Please choose another file")

More here:

tkinter.messagebox (Python 3 documentation)
Standard Dialogs (effbot tkinterbook)

0
phorez On

add this code:

from tkinter import messagebox as mb

if you want to show an error use this:

mb.showerror(title = "", message = "")

but if you want to show a warning use this:

mb.showwarning(title = "", message = "")