Answers for "tkinter clear entry"

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
-1

python tkinter clear tk

tk = Tk()
tk.destroy()
Posted by: Guest on February-16-2021

Python Answers by Framework

Browse Popular Code Answers by Language