I am trying to create a GUI form using Python tkinter. For a ttk Entry widget, I want to set a default text. I do that using the insert() as shown below-
from tkinter import *
from tkinter import ttk
root = Tk()
e = ttk.Entry(root, width=20)
e.pack()
e.insert(0, 'text greater than width of the widget')
The widget shows the beginning portion of the inserted text. Is there a way that I can make it scroll to the end of the inserted text by default?
You can call the xview
method to scroll a given index into view:
e.xview("end")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With