Tkinter มีโมดูลสำเร็จรูปสำหรับ Dialog Box เช่น messagebox, simpledialog, filedialog, colorchooser
ตัวอย่างโค้ด (Message Box)
# Import the tkinter library
from tkinter import *
from tkinter import messagebox
# Create an instance of Tkinter frame
win = Tk()
# Define the geometry of the function
win.geometry("750x250")
answer = messagebox.askyesno("Question", "Do you like Python Tkinter?")
# Create a Label
Label(win, text=answer, font=('Georgia 20 bold')).pack()
win.mainloop()
ผลลัพธ์
แสดงกล่องถาม Yes/No คืนค่า True (1) หรือ False (0) แสดงใน Label
