Tkinter

Message Tkinter | Python 3

In this tutorial, we are going to see how to use Message widget in Tkinter. The Message widget designed to display multiline messages and not editable, automatic line feed and justify content.

Its functionality is very similar to that provided by the Label widget, except that it can also automatically wrap the text, keeping a given width or aspect ratio.
 


 
 

Syntax:

Here is the syntax to create this widget:

msg = Message ( master, option = value, ... )

 

Parameters:
  • master : This represents the parent window.
  • options : Options can be used as comma separated key-value pairs. See the following example:

 

 

Example:
from tkinter import *
  
gui = Tk()

var = StringVar()
msg = Message( gui, textvariable=var, relief=RAISED )

var.set("Hello, Welcome to StackHowTo!")
msg.pack()
gui.mainloop()

Output:


 
mcqMCQPractice competitive and technical Multiple Choice Questions and Answers (MCQs) with simple and logical explanations to prepare for tests and interviews.Read More

Leave a Reply

Your email address will not be published. Required fields are marked *