Tkinter एक पायथन लाइब्रेरी है जिसका उपयोग GUI- आधारित एप्लिकेशन बनाने और विकसित करने के लिए किया जाता है। इस लेख में, हम देखेंगे कि किसी लेबल से टेक्स्ट को कैसे हटाया जाए, जिसमें कुछ टेक्स्ट होगा।
किसी लेबल से टेक्स्ट हटाने के लिए, हम एक संबद्ध बटन बनाएंगे जो लेबल के लिए ट्रिगर के रूप में कार्य करेगा।
उदाहरण
#import Tkinter Library
from tkinter import *
#Create an instance of tkinter frame
win= Tk()
#Define the size and geometry of the frame
win.geometry("700x400")
#Create a function for the Button Comman
def remove_text():
text.config(text=" ")
#Create a text Label
text= Label(win, text= "www.tutorialspoint.com", font= ("Poppins", 30))
text.pack(pady=20)
#Create a Button
my_button= Button(win, text= "Remove Text", command= remove_text)
my_button.pack(pady=10)
win.mainloop() आउटपुट
ऊपर दिए गए कोड को चलाने से एक बटन बन जाएगा जिसका इस्तेमाल लेबल से टेक्स्ट को हटाने के लिए किया जा सकता है।

अब, "टेक्स्ट निकालें" बटन पर क्लिक करें। यह लेबल से टेक्स्ट को हटा देगा और हमें निम्न स्क्रीन मिलेगी।
