Tkinter Label

Tkinter Label widget provides a single-line caption for other widgets available in Python GUI. It contains images. Also used to output simple lines of text on the screen. You have options to manipulate/ design the text.


The Parameter master represents the parent window and options can be used as key-value pairs separated by commas.

Options of Tkinker Label:

bg: Shows the background Color of the Label.

bd: Shows the size of the border around the indicator.

height: Shows the vertical dimension of the new frame.

pady: By using this option extra space added above and below the text. By default it’s 1.

padx: By using this option extra space added to the left and right of the text. By default it’s 1.

image: Used to display an image in the label.

bitmap: To display graphics assign a image to this option.

cursor: It changed to a special cursor type, when the mouse is hovering over this option.

justify: This option used for the alignment changes of the text.

textvariable: This option is used to assign a variable containing text to display.

Underline: By default it’s value is -1.Used to under line the text in the label.

text: This option is used in the label to display one or more lines of text. Set this option to a string of text. Use the new line character (ā€œ\nā€) to insert newlines in it.

relief: Type of the border specifies by this option. By default it’s Flat.

Font: This option used to specify font of the text to be displayed in widget.

wraplength: By setting this option to a number you can limit the number of characters in each line. The default value, 0, means that lines will be broken only at newlines.

from tkinter import *

appWindow = Tk()


label_text = StringVar()
label = Label( appWindow, textvariable=label_text, relief=RAISED, bg="orange" )
label_text.set("Python Tkinter Label Text")

09 Tkinter Label

Comments are closed.