Python Tkinter Label
The Label is used to specify the container box where we can place the text or images. This widget is used to provide the message to the user about other widgets used in the python application.
There are the various options which can be specified to configure the text or the part of the text shown in the Label.
The syntax to use the Label is given below.
A list of possible options is given below.
||It specifies the exact position of the text within the size provided to the widget. The default value is CENTER, which is used to center the text within the specified space.
||The background color displayed behind the widget.
||It is used to set the bitmap to the graphical object specified so that, the label can represent the graphics instead of text.
||It represents the width of the border. The default is 2 pixels.
||The mouse pointer will be changed to the type of the cursor specified, i.e., arrow, dot, etc.
||The font type of the text written inside the widget.
||The foreground color of the text written inside the widget.
||The height of the widget.
||The image that is to be shown as the label.
||It is used to represent the orientation of the text if the text contains multiple lines. It can be set to LEFT for left justification, RIGHT for right justification, and CENTER for center justification.
||The horizontal padding of the text. The default value is 1.
||The vertical padding of the text. The default value is 1.
||The type of the border. The default value is FLAT.
||This is set to the string variable which may contain one or more line of text.
||The text written inside the widget is set to the control variable StringVar so that it can be accessed and changed accordingly.
||We can display a line under the specified letter of the text. Set this option to the number of the letter under which the line will be displayed.
||The width of the widget. It is specified as the number of characters.
||Instead of having only one line as the label text, we can break it to the number of lines where each line has the number of characters specified to this option.