Tkinter Text 위젯은 여러 줄 사용자 입력을 지원하는 입력 위젯입니다. 사용자가 내용과 데이터를 쓸 수 있는 텍스트 편집기라고도 합니다. delete(0, END)를 정의하여 텍스트 위젯의 내용을 지울 수 있습니다. 명령. 마찬가지로 항목 위젯 자체를 클릭하여 콘텐츠를 지울 수 있습니다. 이는 함수를 클릭 이벤트와 결합하여 달성할 수 있습니다.
예시
#Import the required libraries
from tkinter import *
#Create an instance of Tkinter Frame
win = Tk()
#Set the geometry of Tkinter Frame
win.geometry("700x250")
#Define a function to clear the content of the text widget
def click(event):
name.configure(state=NORMAL)
name.delete(0, END)
name.unbind('<Button-1>', clicked)
#Create a Label widget
label = Label(win, text= "Enter Your Name", font= ('Helvetica 13 bold'))
label.pack(pady= 10)
#Create an Entry widget
name = Entry(win, width=45)
name.insert(0, 'Enter Your Name Here...')
name.pack(pady=10)
#Bind the Entry widget with Mouse Button to clear the content
clicked = name.bind('<Button-1>', click)
win.mainloop() 출력
위의 코드를 실행하면 Entry 위젯이 있는 창이 표시됩니다.

항목 필드를 클릭하면 내용이 자동으로 지워집니다.
