A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/python/python-tkinter-label/ below:

Python Tkinter - Label - GeeksforGeeks

Python Tkinter - Label

Last Updated : 12 Jul, 2025

Tkinter Label is a widget that is used to implement display boxes where you can place text or images. The text displayed by this widget can be changed by the developer at any time you want. It is also used to perform tasks such as underlining the part of the text and spanning the text across multiple lines. It is important to note that a label can use only one font at a time to display text. To use a label, you just have to specify what to display in it (this can be text, a bitmap, or an image).

Note: For more reference, you can read our article,

  1. What is Widgets
  2. Python Tkinter Overview
  3. Python Tkinter Tutorial
Tkinter Label Widget Syntax

Syntax: Label ( master, option )

Parameters:

Tkinter Label Options Label Widget in Tkinter Example

In this example, below Python code creates a Tkinter GUI window with a labeled text "Hello, World!". The label is styled with specific attributes such as font, color, and dimensions, and it's positioned at the center with a raised border. Finally, the main event loop is started to display the GUI window until the user interacts with it.

Python3
import tkinter as tk

# Create the main window
root = tk.Tk()
root.geometry("400x250")  # Set window size
root.title("Welcome to My App")  # Set window title

# Create a StringVar to associate with the label
text_var = tk.StringVar()
text_var.set("Hello, World!")

# Create the label widget with all options
label = tk.Label(root, 
                 textvariable=text_var, 
                 anchor=tk.CENTER,       
                 bg="lightblue",      
                 height=3,              
                 width=30,              
                 bd=3,                  
                 font=("Arial", 16, "bold"), 
                 cursor="hand2",   
                 fg="red",             
                 padx=15,               
                 pady=15,                
                 justify=tk.CENTER,    
                 relief=tk.RAISED,     
                 underline=0,           
                 wraplength=250         
                )

# Pack the label into the window
label.pack(pady=20)  # Add some padding to the top


# Run the main event loop
root.mainloop()

Output

Python Tkiner - Label

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4