[Tutor] Text Boxes - deleting and inserting

Alan Gauld alan.gauld at freenet.co.uk
Sat Oct 23 12:31:53 CEST 2004


> First of all a quick intro: My name is Sean Fioritto.

Welcome Sean,

> an Observer object. The problem is with the Text class, specifically
in Update
> when it calls self.delete(1.0, END). This, according to google,
should delete
> the entire box.
>
> Here's the error (m is a model object):
>
> >>> v = CritterView.cView()
> >>> v.update(m)
>
> Traceback (most recent call last):
>   File "<pyshell#26>", line 1, in -toplevel-
>     v.update(m)
>   File "C:\home\projects\CritterView.py", line 18, in update
>     self.delete(1.0, END)
> NameError: global name 'END' is not defined
>
> Here is the code:
>
> from pObservable import Observer
> from Tkinter import Text

You need to import END too...
Tkinter is one of the few occasions when I recommend the

from Tkinter import * approach...

Alternatively just import the module and use

Tkinter.END

HTH,

Alan G



More information about the Tutor mailing list