I'm tinkering around with a scrollable textfield in Python using tkinter and I'm looking for a solution to make it scroll before the user has reached the last line typing.
I prefer to have the text pretty much centered while typing and want my editor to provide this.
I've tried something like this:
from tkinter import *
root = Tk()
root.geometry("600x600")
root.minsize(height=600)
root.title("DTE")
scrollbar = Scrollbar(root)
scrollbar.pack(side = RIGHT, fill = Y)
text_field = Text(root, yscrollcommand = scrollbar.set, state="normal",
bg = "black", fg = "white",
height = 80,
)
##find last line and insert # blank lines with \n
lastline = text_field.index("end")
text_field.insert(lastline, "\n\n\n\n\n\n\n\n\n\n\n le dot")
text_field.pack(fill = BOTH)
root.mainloop()
Either way it fills the textfield with blank lines to infinity, or just once. None works out so far.