Tkinter.Text can never be empty?

Harry Pehkonen harry.pehkonen at hotpop.com
Tue Sep 16 12:27:00 EDT 2003


While setting up some unit tests, I came to the conclusion that a
Tkinter Text widget can never be empty, but will always (?) contain a
\n.  Here is a brief example:

>>> import Tkinter
>>> t = Tkinter.Text()
>>> t.get(0.0, Tkinter.END)
'\n'
>>> t.delete(0.0, Tkinter.END)
>>> t.get(0.0, Tkinter.END)
'\n'
>>> 

My apologies, but I have not checked whether or not this can be
reproduced in Tcl/Tk (which I think might have been appropriate).

My question is:  Is there *always* a trailing \n, is this a bug, or am
I doing something silly?

Thanks!
Harry.




More information about the Python-list mailing list