Answers for "python tkinter entry clear text"

2

python tkinter clear textbox

tex.delete('1.0', END)
Posted by: Guest on April-21-2021
7

tkinter clear entry

widget.delete(0, END)
Posted by: Guest on March-17-2020
1

python tkinter clear entry

# Clear an entry widget on button press
from tkinter import *

root = Tk()

def clearEntryInput():
    entry.delete(0, END)

entry = Entry(root, width=30) # You must .pack() or .grid() on the next line
entry.pack()

Button(root, text="Clear", command=clearEntryInput).pack()

root.mainloop()

# This is the error you get if you .pack() or .grid() on the same line:
# AttributeError: 'NoneType' object has no attribute 'delete'
# https://stackoverflow.com/questions/13002843/attributeerror-nonetype-object-has-no-attribute-delete
Posted by: Guest on May-02-2021

Python Answers by Framework

Browse Popular Code Answers by Language