Tkinter कई functions और modules प्रदान करता है जिनके माध्यम से हम buttons, dialogue boxes, widgets, और बहुत कुछ के साथ fully featured applications बना सकते हैं।
Text widget बनाने के लिए, हम tkinter entry widget function का उपयोग कर सकते हैं जो basically एक constructor है और यह tkinter के window या frame को लेता है। आगे, हम built-in method delete(first, last=None) का उपयोग करके इस text widget की content delete कर सकते हैं जो basically textbox के अंदर एक range लेता है।
इस उदाहरण में, हम एक Delete Button बनाएंगे जो basically दिए गए text box से सभी contents delete करता है।
उदाहरण
from tkinter import *
win = Tk()
win.geometry("600x300")
label = Label(win, text="Write something ??", font=('Helvetica', 25))
label.pack(pady=20)
# Create a Text Widget
text = Text(win, height=10)
text.pack()
def delete():
text.delete("1.0", "end")
# Create a Delete Button to remove the Text from the text-widget
b1 = Button(win, text="Delete", command=delete)
b1.pack(pady=10)
win.mainloop()
आउटपुट
उपरोक्त code चलाने से एक text widget और एक delete button बनेगा जिसका उपयोग text box में लिखे contents को delete करने के लिए किया जा सकता है।

Textbox के अंदर कुछ type करें, और फिर, "Delete" button पर क्लिक करें। यह textbox के अंदर content erase कर देगा।
