Python Tutorial

What is ktMessageBox in Python Tkinter with Example

Understanding ktMessageBox in Tkinter

tkMessageBox Widget is used in Python programs to show message boxes. This module is used to show a message by combining many functions.

Syntax:

messagebox.Function_Name(title, message [, options]) 

Example:

from tkinter import * 

from tkinter import messagebox

rt = Tk()

rt.geometry("300x200")

w = Label(rt, text ='WSC', font = "50") 

w.pack()

messagebox.showinfo("showinfo", "Information")

messagebox.showwarning("showwarning", "Warning")

messagebox.showerror("showerror", "Error")

messagebox.askquestion("askquestion", "Are you sure?")

messagebox.askokcancel("askokcancel", "Want to continue?")

messagebox.askyesno("askyesno", "Find the value?")

messagebox.askretrycancel("askretrycancel", "Try again?")  

rt.mainloop()
Did you find this article helpful?