Errors on text.get()

Peter Otten __peter__ at web.de
Tue Mar 25 17:39:18 EDT 2014


eneskristo at gmail.com wrote:

> Exception in Tkinter callback
> Traceback (most recent call last):
>   File "C:\Python33\lib\tkinter\__init__.py", line 1475, in __call__
>     return self.func(*args)
>   File "C:/Users/User/PycharmProjects/Cesarian Codes/project.py", line 43,
>   in gen_random
>     string = text.get('1.0', 'end')
>   File "C:\Python33\lib\tkinter\__init__.py", line 3104, in get
>     return self.tk.call(self._w, 'get', index1, index2)
> _tkinter.TclError: invalid command name ".44500976.44544352"
> 
> I'm having a strange error. I haven't found anything online so far. If I
> should supply parts of the code, please post here. Thank you in advance!

Once you have destroyed a widget you can no longer access its data:

>>> import tkinter as tk
>>> root = tk.Tk()
>>> text = tk.Text(root)
>>> text.pack()
>>> text.get("1.0", "end")
'\n'
>>> text.destroy()
>>> text.get("1.0", "end")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.3/tkinter/__init__.py", line 3107, in get
    return self.tk.call(self._w, 'get', index1, index2)
_tkinter.TclError: invalid command name ".140692133333008"





More information about the Python-list mailing list