Python Tkinter Message Widget is widely used to display the text on the window.It is really similar to the Label widget.But there is a small noticeable difference between these two widgets is its length.
Simply, Label doesn’t support to write the multiple lines text on it whereas Message Widget supports multiple lines of text but not larger texts.It supports only a few lines.If you want to write larger texts you can attain it using PYTHON TKINTER TEXT WIDGET.
Let’s Write the simple code.Python Tkinter Message Widget
from Tkinter import *
main = Tk()
ourMessage = "This is our Message"
messageVar = Message(main, text = ourMessage)
messageVar.config(bg='lightgreen', font=('times', 24, 'italic'))
In the above code, firstly, I created the ourMessage Variable to save my message.
Later I created a new Variable called messageVar which is a Message widget that has two parameters of parent window and text (assigned ourMessage to it) parameter
The next line is mesageVar.Config() function that has two parameters one is the bg and another is the font which has many options.
The best thing about Tkinter Message Widget is it can create multiple lines automatically according to their configuration that we have given.
Typical Syntax For Python Tkinter Message Widget
message = Message(master,option,…)
Download Python Tkinter Widgets Options PDF