Want a Text widget that scrolls without the extra hassle of manually adding scrollbars?
You’re in luck.
This beginner-friendly guide will walk you through Tkinter’s ScrolledText widget — step by step with code, clear explanations, and some fun along the way.
Contents
🤔 What is Tkinter ScrolledText?
ScrolledText is like a Text widget’s cooler sibling.
It comes preloaded with a vertical scrollbar — so you don’t need to wire up a scrollbar manually.
Imagine you’re building a chat app or a log viewer — where lots of text keeps piling up.
You’ll want it to scroll automatically, right?
That’s where ScrolledText
shines.

🔧 How to Create a ScrolledText Widget
Let’s break it down.
Step 1: Import ScrolledText
import tkinter as tk
from tkinter.scrolledtext import ScrolledText
✅ It’s not in tkinter
directly. You import it from tkinter.scrolledtext
.
Step 2: Create the Widget
root = tk.Tk()
text = ScrolledText(root, width=80, height=10)
root
is your parent window or frame.
You can configure things like width
, height
, font
, etc.
Step 3: Pack it
text.pack(padx=10, pady=10, fill=tk.BOTH, expand=True)
And — you’ve got a scrolling text area.
🧪 Full Example — ScrolledText in Action
import tkinter as tk
from tkinter.scrolledtext import ScrolledText
root = tk.Tk()
root.title("ScrolledText Demo")
text = ScrolledText(root, width=80, height=10)
text.pack(padx=10, pady=10, fill=tk.BOTH, expand=True)
root.mainloop()

📥 ScrolledText Get Text
Let’s say you want to grab whatever the user typed.
user_input = text.get("1.0", tk.END)
print(user_input)
"1.0"
means line 1, character 0 — the very beginningtk.END
means all the way to the end (including that final newline)
📝 ScrolledText Set Text
Want to prefill the box? Here’s how:
text.insert(tk.END, "Welcome to my awesome app!")
text.delete("1.0", tk.END)
text.insert(tk.END, "New content goes here!")
If you want to replace everything:
⬇️ Tkinter ScrolledText Scroll to Bottom
Great for chat logs or real-time data feeds.
text.see(tk.END)
🔒 Tkinter ScrolledText Read Only
Don’t want users to edit the text?
Set the state to "disabled"
:
text.config(state="disabled")
If you need to update the text later, temporarily enable it:
text.config(state="normal")
text.insert(tk.END, "Appended text!\n")
text.config(state="disabled")
🧰 Useful ScrolledText Methods
Since ScrolledText
is a subclass of Text
, you can use all Text widget methods:
Method | What it does |
---|---|
.get(start, end) | Get the text in a range |
.insert(index, s) | Insert text at a given position |
.delete(start, end) | Remove text between two points |
.see(index) | Scroll to a specific position |
.config(**options) | Change appearance or behavior |
.index(index) | Convert index to string format (e.g., ‘1.0’) |