Skip to content
Related Articles

Related Articles

Save Article
Improve Article
Save Article
Like Article

How to remove text from a label in Python?

  • Last Updated : 20 Jul, 2021

Prerequisite: Python GUI – tkinter

In this article, the Task is to remove the text from label, once text is initialized in Tkinter. Python offers multiple options for developing GUI (Graphical User Interface) out of which Tkinter is the most preferred means. It is a standard Python interface to the Tk GUI toolkit shipped with Python. Python with Tkinter is the fastest, most reliable and easiest way to create a desired GUI application. 

 Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.  

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning - Basic Level Course

The Task is to remove the text from label, once text is initialized in Tkinter.


  • Import module
  • Create a normal Tkinter window.
  • Add Label and Create One Button


Text(Object Name,text=”Enter Text”, **attr)

  • For remove the text, we will use config() method in Tkinter

config is used to access an object’s attributes after its initialization.



Given below is the program to implement the same:


# Import Module
from tkinter import *
# Create Object
root = Tk()
# specify size of window.
# Remove text from label
def remove_text():
# Create Label
label = Label(root, text="Hello World!", font="BOLD")
# Create Delete Button
Button(root, text="Delete", command=remove_text).pack()
# Execute Tkinter


Output:before clicking delete

Output:after clicking delete

My Personal Notes arrow_drop_up
Recommended Articles
Page :