हम टेक्स्ट और छवियों को प्रदर्शित करने के लिए टिंकर लेबल विजेट का उपयोग कर सकते हैं। लेबल विजेट को कॉन्फ़िगर करके, हम विजेट के टेक्स्ट, छवियों और अन्य गुणों को गतिशील रूप से बदल सकते हैं।
लेबल विजेट को गतिशील रूप से अपडेट करने के लिए, हम कॉन्फ़िगरेशन(**विकल्प) . का उपयोग कर सकते हैं या एक इनलाइन कॉन्फ़िगरेशन विधि जैसे टेक्स्ट को अपडेट करने के लिए, हम लेबल["text"]=text; . का उपयोग कर सकते हैं लेबल विजेट को हटाने के लिए, हम pack_forget() . का उपयोग कर सकते हैं विधि।
उदाहरण
# Import the required libraries
from tkinter import *
from tkinter import ttk
from PIL import ImageTk, Image
# Create an instance of tkinter frame or window
win=Tk()
# Set the size of the window
win.geometry("700x350")
def add_label():
global label
label=Label(win, text="1. A Newly created Label", font=('Aerial 18'))
label.pack()
def remove_label():
global label
label.pack_forget()
def update_label():
global label
label["text"]="2. Yay!! I am updated"
# Create buttons for add/remove/update the label widget
add=ttk.Button(win, text="Add a new Label", command=add_label)
add.pack(anchor=W, pady=10)
remove=ttk.Button(win, text="Remove the Label", command=remove_label)
remove.pack(anchor=W, pady=10)
update=ttk.Button(win, text="Update the Label", command=update_label)
update.pack(anchor=W, pady=10)
win.mainloop() उपरोक्त कोड को चलाने से एक विंडो प्रदर्शित होगी जिसमें कुछ बटन होंगे। प्रत्येक बटन का उपयोग एप्लिकेशन में एक लेबल को अपडेट/निकालने या जोड़ने के लिए किया जा सकता है।
आउटपुट

"अपडेट द लेबल" बटन पर क्लिक करने पर, लेबल निम्नानुसार अपडेट हो जाएगा -
