Tkinter là module GUI của Python. Dùng các tùy chọn hiển thị thông báo phản hồi hành động người dùng hoặc thay đổi trạng thái. Lớp messagebox hiển thị xác nhận, lỗi, cảnh báo...
Ví dụ 1: Message tùy chỉnh
import tkinter as tk
main = tk.Tk()
key = "the key to success is to focus on goals and not on obstacles"
message = tk.Message(main, text=key)
message.config(bg='white', font=('times', 32, 'italic'))
message.pack()
tk.mainloop()
Kết quả hình ảnh hiển thị thông báo tùy chỉnh.

Ví dụ 2: Các hộp thoại chuẩn
messagebox có nhiều hàm cho loại thông báo khác nhau.
Hộp hỏi (Question Box)
Dùng askquestion().
from tkinter.messagebox import *
print(askquestion("Question", "Proceed to next Step?"))

Hộp thử lại (Retry Box)
Dùng askretrycancel().
from tkinter.messagebox import *
print(askretrycancel("Retry", "Try Again?"))

Hộp lỗi (Error Box)
Dùng showerror().
from tkinter.messagebox import *
print(showerror("Error", "Error in checkout"))

Hộp cảnh báo (Warning Box)
Dùng showwarning().
from tkinter.messagebox import *
print(showwarning("Warning", "This may result in delay !"))
