Tkinter.Text can never be empty?

vincent wehren vincent at visualtrans.de
Tue Sep 16 13:47:09 EDT 2003


"Harry Pehkonen" <harry.pehkonen at hotpop.com> schrieb im Newsbeitrag
news:70df36e9.0309160826.596dd5ab at posting.google.com...
| 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?

Nope, this is one of the idiosyncrasies of our friend the Text widget;
there's always this immortal LF at the end.

Vincent Wehren
|
| Thanks!
| Harry.






More information about the Python-list mailing list