[Tutor] Unicode, Tkinter, and Duct Repairs

Doug Stanfield DOUGS@oceanic.com
Sat, 23 Sep 2000 11:57:39 -1000


[Joseph Stubenrauch asked:]
> I am trying to delete the last character
> that has been entered into an entry widget.  I have
> the whole insert thing down pat, but I can't seem to
> delete things properly.  I just need a good example to
> get me going (since man pages seem to just boggle me).
> I was hoping entrywidget.delete(END - 1) would work,
> but I suppose that was a bit optimistic of me. =)

I don't do Tkinter, but I'll give you a generic answer.  

Python 1.5.2 (#1, Apr 18 1999, 16:03:16)  [GCC pgcc-2.91.60 19981201
(egcs-1.1.1
  on linux2
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> test = 'this is a string'
>>> test = test[:-1]
>>> test
'this is a strin'
>>>

You'll undoubtably have a way to get and set the string from the
entrywidget, so I'll assume they are just using an attribute such as
entrywidget.text:

entrywidget.text = entrywidget.text[:-1]

Hope this is what you were looking for.

-Doug-