1import tkinter
2from tkinter import messagebox
3# hide main window
4root = tkinter.Tk()
5# message box display
6messagebox.showerror("Error", "Error message")
7messagebox.showwarning("Warning","Warning message")
8messagebox.showinfo("Information","Informative message")
1import tkinter as tk
2from tkinter import messagebox as mb
3
4def answer():
5 mb.showerror("Answer", "Sorry, no answer available")
6
7def callback():
8 if mb.askyesno('Verify', 'Really quit?'):
9 mb.showwarning('Yes', 'Not yet implemented')
10 else:
11 mb.showinfo('No', 'Quit has been cancelled')
12
13tk.Button(text='Quit', command=callback).pack(fill=tk.X)
14tk.Button(text='Answer', command=answer).pack(fill=tk.X)
15tk.mainloop()
16
1from tkinter import messagebox
2
3messagebox.showinfo('Title', 'Information')
1import Tkinter
2import tkMessageBox
3
4top = Tkinter.Tk()
5def hello():
6 tkMessageBox.showinfo("Say Hello", "Hello World")
7
8B1 = Tkinter.Button(top, text = "Say Hello", command = hello)
9B1.pack()
10
11top.mainloop()
1from tkinter import *
2from tkinter import messagebox
3
4def listMessageBox(arr):
5 window=Tk()
6 listbox=Listbox(window)
7 listbox.pack(fill=BOTH, expand=1) #adds listbox to window
8 [listbox.insert(END, row) for row in arr] #one line for loop
9 window.mainloop()
10
11arr=['a','b','c','1','2','3']
12
13listMessageBox(arr)