about Tkinter delete

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

about Tkinter delete

Jia-Yu Aw
Hi all

I don't understand why I get this error. I'm trying to delete the existing points, then redraw them after this bit of code to 'animate' my simulation.

def update(self, point1, point2):
        # Deletes existing points
        if self.point1:
            self.w.delete(point1)
            self.master.update_idletasks()
        if self.point2:
            self.w.delete(point2)
            self.master.update_idletasks()
#draw new point
# . . .

The error message that I get is:
. . . in update
    self.w.delete(point1)
  File "C:\PYTHON26\LIB\LIB-TK\Tkinter.py", line 2181, in delete
    self.tk.call((self._w, 'delete') + args)
TclError: invalid command name ".44593760"





_______________________________________________
Tkinter-discuss mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/tkinter-discuss
Reply | Threaded
Open this post in threaded view
|

Re: about Tkinter delete

Michael O'Donnell
Dear Kristen,

   Sorry, don't know the context of your code, but I
note that you are checking if self.point1 is defined, and
if so, try to delete point1 (which is a different variable).

Also, self.point1/point1 may be defined, but may not
correspond to an existing tk widget. The error message
suggests that you are trying to delete a widget (.44593760)
which has already been deleted.

Mick

On Mon, Nov 7, 2011 at 2:26 AM, Kristen Aw <[hidden email]> wrote:

> Hi all
> I don't understand why I get this error. I'm trying to delete the existing
> points, then redraw them after this bit of code to 'animate' my simulation.
> def update(self, point1, point2):
>         # Deletes existing points
>         if self.point1:
>             self.w.delete(point1)
>             self.master.update_idletasks()
>         if self.point2:
>             self.w.delete(point2)
>             self.master.update_idletasks()
> #draw new point
> # . . .
> The error message that I get is:
> . . . in update
>     self.w.delete(point1)
>   File "C:\PYTHON26\LIB\LIB-TK\Tkinter.py", line 2181, in delete
>     self.tk.call((self._w, 'delete') + args)
> TclError: invalid command name ".44593760"
>
>
>
>
> _______________________________________________
> Tkinter-discuss mailing list
> [hidden email]
> http://mail.python.org/mailman/listinfo/tkinter-discuss
>
>
_______________________________________________
Tkinter-discuss mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/tkinter-discuss