In this tutorial, we will learn about Python Tkinter Message. Python Tkinter Message works same as Lable expect it can automatically wrap up content and given width. We mainly use this widget to show the multiline text.

Syntax to add Python Tkinter Message:

w = Message (master, options)
  • master: This represents the parent window.
  • options: Here is the list of most commonly used options for this widget.

Example Program of Python Tkinter Message:

from tkinter import *  
 
mainWindow = Tk()  

mainWindow.geometry("300x150")

text = StringVar()

text.set("Hello, Welcome to Owlbuddy")

label = Message( mainWindow, textvariable=text, relief=RAISED )

label.pack()

mainWindow.mainloop() 

Output:

Python Tkinter Message

Various possible options in Python Tkinter Message:

OptionDescription
anchorThis option is used to set the position of text in widget The default is anchor=CENTER.
bgThis option helps us to set the normal background colour of the widget.
bitmapThis option helps us to display an image. You just have to set this option equal to an image object.
bdThis option is used to set the size of the border around the widget.
cursorThis option helps us to set the style of cursor like an arrow, dot etc
fontThis option is used to set font type in the widget.
fgThis option helps us to set the normal foreground colour of the widget.
heightThis option helps us to set the height of the widget.
imageThis option helps us to show the image with the radio button instead of text.
justifyThis helps us to automatically organize the text in multiple lines.
padxThis option helps us to set the space left and right.
padyThis option helps us to set space above and below.
reliefThis helps us to set the style of the border by which is default Flat.
textThis option helps us to set a string source for the label.
textvariableThis option is used to mention text source(variable.)
underlineThis option helps us to underline the specified letter of the text.
widthThis helps us to set the width of the widget.
wraplengthThis option is used to wrap text into the number of lines.