Skip to content

Instantly share code, notes, and snippets.

@Yagisanatode
Last active April 22, 2022 19:51
Show Gist options
  • Save Yagisanatode/6ccef95e75c5686474c7 to your computer and use it in GitHub Desktop.
Save Yagisanatode/6ccef95e75c5686474c7 to your computer and use it in GitHub Desktop.
Scrolling with inserted text using ScrolledText "yview" in tkinter
###Tkinter Scrolling with Text###
'''Make text scroll to the bottom of the text box as new entries appear'''
from tkinter import *
from tkinter.scrolledtext import *
window = Tk()
window.wm_title("Scroll From Bottom")
TextBox = ScrolledText(window, height='10', width='45', wrap=WORD)
#
#Just adds 100 lines to the TextBox
count = 0
while(count<100):
TextBox.insert(END, "The count is: " +str(count)+"\n")
#Pushes the scrollbar and focus of text to the end of the text input.
TextBox.yview(END)
count += 1
TextBox.pack()
window = mainloop()
@0x4248
Copy link

0x4248 commented Jan 12, 2021

thanks :)

@nagars
Copy link

nagars commented May 15, 2021

Thank you very much!

@Vikasitha444
Copy link

very useful

@MrWoon4ik
Copy link

thanks! I shear it from google :D ||| Спасибо! Я искал это в google :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment