I am working on a virtual console, which would use the systems builtin commands and then do the action and display output results on next line in console. This is all working, but how do I get the contents of the last line, and only the last line in the tkinter text widget? Thanks in advance. I am working in python 3.
I have treed using text.get(text.linestart, text.lineend) To no avail. Have these been deprecated? It spits out an error saying that AttributeError: 'Text' object has no attribute 'linestart'
You can apply modifiers to the text widget indicies, such as linestart and lineend as well as adding and subtracting characters. The index after the last character is "end".
Putting that all together, you can get the start of the last line with "end-1c linestart".
How to get the contents of last line in tkinter text widget (Python 3)