Reputation: 203
I am a GUI that uses an entry field, I want the delete button to delete the end character held in the index within the entry field. I have managed to get my clear button working, by doing the following
entry.delete(0, END) #Deletes all values in the entry field
I thought I could just do the following to delete the end item but it does not work. Any ideas
entry.delete(END)
I replace 'END' above with a number it will delete that number, but I'm sure there must be a quicker way.
Upvotes: 0
Views: 260
Reputation: 20679
You can calculate the length of the text and use it as the start of the range:
start = len(entry.get()) - 1
entry.delete(start, END)
Upvotes: 1