This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: tkinter.Text() add a newline to the content - bug?
Type: Stage:
Components: Tkinter Versions: Python 3.3
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Friedrich.Spee.von.Langenfeld, gpolo, terry.reedy
Priority: normal Keywords:

Created on 2013-06-17 20:04 by Friedrich.Spee.von.Langenfeld, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (2)
msg191370 - (view) Author: Friedrich Spee von Langenfeld (Friedrich.Spee.von.Langenfeld) Date: 2013-06-17 20:04
Python 3.3.2 (v3.3.2:d047928ae3f6, May 16 2013, 00:06:53) [MSC v.1600 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> from tkinter import*
>>> root = Tk()
>>> text = Text()
>>> text.pack()
>>> text.insert(1.0, "Hello")
>>> text.get(1.0, END)

The tkinter.Text() widget add a newline (\n) to its content. Is this behavior a bug?
msg191614 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2013-06-21 22:19
You omitted the crucial control experiment.
>>> t2=tk.Text()
>>> t2.get(1.0, tk.END)
Text widgets are initialized to end with \n. I suspect that this is an  intentional invariant of tk Text widgets, done by tk itself and not out tkinter wrapper, even if not well documented in the tkinter doc strings.

.insert works as documented.

So unless you can determine that this initialization is a recent and unintentional change, we would not change it. Hence closing at least for now.

(G.P., if you think this is wrong, re-open)

PS. python-list mirrrored on comp.lang.python and gmane.comp.python.general is a better place to ask 'Is this a bug?' and similar questions.
Date User Action Args
2022-04-11 14:57:47adminsetgithub: 62446
2013-06-21 22:19:21terry.reedysetstatus: open -> closed

nosy: + terry.reedy, gpolo
messages: + msg191614

resolution: not a bug
2013-06-17 20:04:58Friedrich.Spee.von.Langenfeldcreate