TheDeveloperBlog.com

Home | Contact Us

C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML

Python Tkinter Message

Python Tkinter Message with python tutorial, tkinter, button, overview, entry, checkbutton, canvas, frame, environment set-up, first python program, basics, data types, operators, etc.

<< Back to PYTHON

Python Tkinter Message

The Message widget is used to show the message to the user regarding the behaviour of the python application. The message widget shows the text messages to the user which can not be edited.

The message text contains more than one line. However, the message can only be shown in the single font.

The syntax to use the Message widget is given below.

Syntax

w = Message(parent, options)

A list of possible options is given below.

SN Option Description
1 anchor It is used to decide the exact position of the text within the space provided to the widget if the widget contains more space than the need of the text. The default is CENTER.
2 bg The background color of the widget.
3 bitmap It is used to display the graphics on the widget. It can be set to any graphical or image object.
4 bd It represents the size of the border in the pixel. The default size is 2 pixel.
5 cursor The mouse pointer is changed to the specified cursor type. The cursor type can be an arrow, dot, etc.
6 font The font type of the widget text.
7 fg The font color of the widget text.
8 height The vertical dimension of the message.
9 image We can set this option to a static image to show that onto the widget.
10 justify This option is used to specify the alignment of multiple line of code with respect to each other. The possible values can be LEFT (left alignment), CENTER (default), and RIGHT (right alignment).
11 padx The horizontal padding of the widget.
12 pady The vertical padding of the widget.
13 relief It represents the type of the border. The default type is FLAT.
14 text We can set this option to the string so that the widget can represent the specified text.
15 textvariable This is used to control the text represented by the widget. The textvariable can be set to the text that is shown in the widget.
16 underline The default value of this option is -1 that represents no underline. We can set this option to an existing number to specify that nth letter of the string will be underlined.
17 width It specifies the horizontal dimension of the widget in the number of characters (not pixel).
18 wraplength We can wrap the text to the number of lines by setting this option to the desired number so that each line contains only that number of characters.

Example

from tkinter import *

top = Tk()
top.geometry("100x100")
var = StringVar()
msg = Message( top, text = "Welcome to TheDeveloperBlog")

msg.pack()
top.mainloop()

Output:

Python Tkinter Message



Related Links:


Related Links

Adjectives Ado Ai Android Angular Antonyms Apache Articles Asp Autocad Automata Aws Azure Basic Binary Bitcoin Blockchain C Cassandra Change Coa Computer Control Cpp Create Creating C-Sharp Cyber Daa Data Dbms Deletion Devops Difference Discrete Es6 Ethical Examples Features Firebase Flutter Fs Git Go Hbase History Hive Hiveql How Html Idioms Insertion Installing Ios Java Joomla Js Kafka Kali Laravel Logical Machine Matlab Matrix Mongodb Mysql One Opencv Oracle Ordering Os Pandas Php Pig Pl Postgresql Powershell Prepositions Program Python React Ruby Scala Selecting Selenium Sentence Seo Sharepoint Software Spellings Spotting Spring Sql Sqlite Sqoop Svn Swift Synonyms Talend Testng Types Uml Unity Vbnet Verbal Webdriver What Wpf