Tkinter Message

Tkinter Message widget is used to show the message to the user which can not be edited in Python GUI. Its functionality is very similar to the one provided by the Label widget. This widget provides a multiline and noneditable object that displays texts. This contains more than one line.

Syntax:

The Parameter master represents the parent window and options can be used as key-value pairs separated by commas.

Options of Tkinker Message:

bd: Shows the border around the indicator.

bg: Shows the background color behind the label and indicator.

padx: Shows the horizontal padding of the widget.

pady: Shows the vertical padding of the widget.

height: Shows the vertical dimension of the new frame.

fg: Font color of the widget text.

font: Font type of the widget text.

relief: It represents the type of the border. The default type is Flat.

bitmap: Used to display a monochrome image.

width: It specifies the horizontal dimension of the widget in the number of characters (not pixel).

text: Used newlines (ā€œ\nā€) to display multiple lines of text.

variable: Used to represents the associated variable that tracks the state of the widget.

wraplength: It will broke text into the number of pieces.

anchor: Used to decide the exact position of the text within the space .By default value is Center.

Example:
from tkinter import *

appWindow = Tk()
appWindow.title("Window Title-Tutorialsart.com")

appWindow.geometry('350x200')


w = Label(appWindow, text='TKINTER Label', font="30")
w.pack()

msg = Message(appWindow, text="TKINTER Message", bg="orange")

msg.pack()


appWindow.mainloop()
Output:
10 tkinter message

Comments are closed.