The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →For a text-backed Tkinter label, read its current text option with label.cget("text"). The equivalent shorthand is label["text"]. If the label uses textvariable, read the linked Tk variable with its .get() method instead.
Read the text option from a Label
Both classic tkinter.Label and themed ttk.Label support the standard widget option API. Use cget() when you want to make the read explicit:
text = label.cget("text")
Option indexing returns the same value:
text = label["text"]
Python’s Tkinter documentation describes cget() as retrieving a widget option’s current value and documents option indexing as equivalent. The call returns the option value as a string.
Complete classic Label example
import tkinter as tk
root = tk.Tk()
label = tk.Label(root, text="Hello")
label.pack()
print(label.cget("text")) # Hello
root.mainloop()
You can also query an option with label.configure("text"). Use configure(text="New text") to change it; that form configures the widget rather than reading the option.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Repair Windows errors before they cause bigger problems3Fix the driver behind crashes, sound loss and screen glitches#1 Best Overall
Read text from a Label with textvariable
When a label is created with textvariable, the displayed value is linked to a Tk variable. Read the current value from that variable, not by treating the label’s text option as the source of truth:
import tkinter as tk
from tkinter import ttk
root = tk.Tk()
message = tk.StringVar(value="Ready")
label = ttk.Label(root, textvariable=message)
label.pack()
print(message.get()) # Ready
root.mainloop()
Keep a reference to the variable object while the widget uses it. Tkinter’s documentation notes that when a Variable object is garbage-collected, its Tcl variable is unset.
Rank #2
Does this work with ttk.Label?
Yes. A themed ttk.Label inherits the standard widget option methods, so for a label configured with text, use label.cget("text") or label["text"] just as you would with tkinter.Label. The ttk reference confirms the themed widget API; that URL documents Python 3.16.0a0 development documentation, not a released version.
What the text option does—and does not—tell you
A Tkinter Label can display a text string, bitmap, or image. Reading label.cget("text") gets the value of the text option; it does not extract words from an image or bitmap. If the label is displaying another kind of content, the text option may not describe what is visible.
A Label is non-interactive. If the user needs to edit text or work with a text area, use an appropriate Entry or Text widget rather than a Label.
Quick Recap
Best Value
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.




