Movatterモバイル変換


[0]ホーム

URL:


Open In App
Next Article:
What are Widgets in Tkinter?
Next article icon
Python offers multiple options for developing a GUI (Graphical User Interface). Out of all the GUI methods, Tkinter is the most commonly used method. It is a standard Python interface to the Tk GUI toolkit shipped with Python. Python with Tkinter is the fastest and easiest way to create GUI applications. Creating a GUI using Tkinter is an easy task.Note: For more information, refer toPython GUI – tkinter

Message widget

The Message widget is used to show the message to the user regarding the behavior of the python application. The message text contains more than one line.Syntax:The syntax to use the message is given below.
w = Message( master, options)
Parameters:
  • master: This parameter is used to represents the parent window.
  • options:There are many options which are available and they can be used as key-value pairs separated by commas.
Options:Following are commonly used Option can be used with this widget :-
  • anchor:This option is used to decide the exact position of the text within the space .Its default value is CENTER.
  • bg:This option used to represent the normal background color.
  • bitmap:This option used to display a monochrome image.
  • bd:This option used to represent the size of the border and the default value is 2 pixels.
  • cursor:By using this option, the mouse cursor will change to that pattern when it is over type.
  • font:This option used to represent the font used for the text.
  • fg:This option used to represent the color used to render the text.
  • height:This option used to represent the number of lines of text on the message.
  • image:This option used to display a graphic image on the widget.
  • justify:This option used to control how the text is justified: CENTER, LEFT, or RIGHT.
  • padx:This option used to represent how much space to leave to the left and right of the widget and text. It's default value is 1 pixel.
  • pady:This option used to represent how much space to leave above and below the widget. It's default value is 1 pixel.
  • relief: The type of the border of the widget. It's default value is set to FLAT.
  • text:This option used use newlines ("\n") to display multiple lines of text.
  • variable: This option used to represents the associated variable that tracks the state of the widget.
  • width:This option used to represents the width of the widget. and also represented in the number of characters that are represented in the form of texts.
  • wraplength:This option will be broken text into the number of pieces.
Example:Python3
fromtkinterimport*root=Tk()root.geometry("300x200")w=Label(root,text='GeeksForGeeks',font="50")w.pack()msg=Message(root,text="A computer science portal for geeks")msg.pack()root.mainloop()
Output:

Improve

Similar Reads

We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood ourCookie Policy &Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences

[8]ページ先頭

©2009-2025 Movatter.jp