DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk1 min

How to Change Label Text in Tkinter

Change an existing Tkinter label with config(text=...) or configure(text=...). For automatically updated text, bind a StringVar and call set().
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To change the text of an existing Tkinter label, call label.config(text="Updated text"). You can also write label.configure(text="Updated text"); config() is an alias of configure(). For text that should follow changing application state, connect the label to a StringVar and update that variable with set().

Change an existing label directly

A Label displays text, a bitmap, or an image, and its text can be changed after the widget has been created. Python’s Tkinter documentation describes config() as an alias of configure(); either method accepts the text option.

label.config(text="Updated text")
# Equivalent:
label.configure(text="Updated text")

Use this approach when code explicitly decides when to replace the label’s text, such as after a button click or a completed operation.

Keep a label in sync with changing state

If a displayed value changes over time, bind a Tkinter StringVar to the label with textvariable. Updating the Tk variable then updates the linked label.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
import tkinter as tk

root = tk.Tk()
message = tk.StringVar(value="Ready")
label = tk.Label(root, textvariable=message)
label.pack()

message.set("Processing complete")
root.mainloop()

Use a Tkinter variable such as StringVar for this connection. Reassigning an ordinary Python string does not notify the widget:

message = "Processing complete"  # Does not update a label by itself

Instead, retain the Tk variable and call its set() method, as in the example above. The Tkinter documentation covers Tkinter’s variable classes and widget options.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Use the same options with ttk.Label

Themed labels created with ttk.Label support both text and textvariable. Set the text directly when configuring the widget, or bind a Tkinter variable when the displayed value should track application state.

from tkinter import ttk

ttk_label = ttk.Label(root, text="Ready")
ttk_label.config(text="Updated text")

For a variable-driven ttk label, pass a Tkinter variable as textvariable in the same way as with tk.Label.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Sale
Python and Tkinter Programming
  • Used Book in Good Condition

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.