[Tutor] Undrawing text

Daniel Yoo dyoo@hkn.eecs.berkeley.edu
Mon, 13 Nov 2000 12:52:17 -0800 (PST)


On Sat, 11 Nov 2000, Devansh wrote:

> in my graphics window i want to update a count for every mouse click i
> make....... what my code is doing is just drawing the new numbers on
> top the of the old ones so it becomes illegible after the 2nd cklick
> already......

> heres a section of the code.
> count=count+1
> counter=Text(Point(320,240),count).draw(win1)
> 
> if i use counter.undraw(win1) it gives me an attribute error.......
> pls advise.....thanx

Text widgets don't have an undraw() as far as I can tell.  However, they
do have a delete() method that works.  Here's a way of clearing your Text
widget:

   counter.delete("@0,0", END)

which means "Delete everything starting from position 0,0 to the END".  I
have to admit that I have absolutely NO experience with the Text widget,
so there may be a better way of doing this.  (I've only glanced at my
"Python and Tkinter Programming" book.)

Again, sorry for the long wait on that one; I was hoping someone else
would be familiar with Tkinter... *sigh*