Tkinter has three geometry managers: pack, grid, and place.
Pack and grid are usually recommended over place.

You can use the grid manager's row and column options
to position the Scrollbar next to the Text widget.

Set the Scrollbar widget's command option to the Text's yview method.

scrollb = tkinter.Scrollbar(..., command=txt.yview)

Set the Text widget's yscrollcommand option to the Scrollbar's set method.

txt['yscrollcommand'] = scrollb.set

Here's a working example that makes use of ttk:

import tkinter
import tkinter.ttk as ttk

class TextScrollCombo(ttk.Frame):

    def __init__(self, *args, **kwargs):
        
        super().__init__(*args, **kwargs)
        
    # ensure a consistent GUI size
        self.grid_propagate(False)
    # implement stretchability
        self.grid_rowconfigure(0, weight=1)
        self.grid_columnconfigure(0, weight=1)
        
    # create a Text widget
        self.txt = tkinter.Text(self)
        self.txt.grid(row=0, column=0, sticky="nsew", padx=2, pady=2)

    # create a Scrollbar and associate it with txt
        scrollb = ttk.Scrollbar(self, command=self.txt.yview)
        scrollb.grid(row=0, column=1, sticky='nsew')
        self.txt['yscrollcommand'] = scrollb.set

main_window = tkinter.Tk()

combo = TextScrollCombo(main_window)
combo.pack(fill="both", expand=True)
combo.config(width=600, height=600)

combo.txt.config(font=("consolas", 12), undo=True, wrap='word')
combo.txt.config(borderwidth=3, relief="sunken")

style = ttk.Style()
style.theme_use('clam')

main_window.mainloop()

The part that will address your Scrollbar being small is sticky='nsew',
which you can read about โ†’ here.

Something that will be helpful for you to learn right now is that different Tkinter widgets can use different geometry managers within the same program as long as they do not share the same parent.


The tkinter.scrolledtext module contains a class called ScrolledText which is a compound widget (Text & Scrollbar).

import tkinter
import tkinter.scrolledtext as scrolledtext

main_window = tkinter.Tk()

txt = scrolledtext.ScrolledText(main_window, undo=True)
txt['font'] = ('consolas', '12')
txt.pack(expand=True, fill='both')

main_window.mainloop()

The way this is implemented is worth taking a look at.

Answer from Honest Abe on Stack Overflow
Top answer
1 of 4
69

Tkinter has three geometry managers: pack, grid, and place.
Pack and grid are usually recommended over place.

You can use the grid manager's row and column options
to position the Scrollbar next to the Text widget.

Set the Scrollbar widget's command option to the Text's yview method.

scrollb = tkinter.Scrollbar(..., command=txt.yview)

Set the Text widget's yscrollcommand option to the Scrollbar's set method.

txt['yscrollcommand'] = scrollb.set

Here's a working example that makes use of ttk:

import tkinter
import tkinter.ttk as ttk

class TextScrollCombo(ttk.Frame):

    def __init__(self, *args, **kwargs):
        
        super().__init__(*args, **kwargs)
        
    # ensure a consistent GUI size
        self.grid_propagate(False)
    # implement stretchability
        self.grid_rowconfigure(0, weight=1)
        self.grid_columnconfigure(0, weight=1)
        
    # create a Text widget
        self.txt = tkinter.Text(self)
        self.txt.grid(row=0, column=0, sticky="nsew", padx=2, pady=2)

    # create a Scrollbar and associate it with txt
        scrollb = ttk.Scrollbar(self, command=self.txt.yview)
        scrollb.grid(row=0, column=1, sticky='nsew')
        self.txt['yscrollcommand'] = scrollb.set

main_window = tkinter.Tk()

combo = TextScrollCombo(main_window)
combo.pack(fill="both", expand=True)
combo.config(width=600, height=600)

combo.txt.config(font=("consolas", 12), undo=True, wrap='word')
combo.txt.config(borderwidth=3, relief="sunken")

style = ttk.Style()
style.theme_use('clam')

main_window.mainloop()

The part that will address your Scrollbar being small is sticky='nsew',
which you can read about โ†’ here.

Something that will be helpful for you to learn right now is that different Tkinter widgets can use different geometry managers within the same program as long as they do not share the same parent.


The tkinter.scrolledtext module contains a class called ScrolledText which is a compound widget (Text & Scrollbar).

import tkinter
import tkinter.scrolledtext as scrolledtext

main_window = tkinter.Tk()

txt = scrolledtext.ScrolledText(main_window, undo=True)
txt['font'] = ('consolas', '12')
txt.pack(expand=True, fill='both')

main_window.mainloop()

The way this is implemented is worth taking a look at.

2 of 4
18

If you're working with an INPUT box, then a handy way using the scrolledtext function. It took me 4+ hours to find it. Don't ya love tkinter?

Two things to note... The additional import required import tkinter.scrolledtext as tkscrolled and you set default value using insert and read the value using get (more terrible naming)

This bit of code was central to making my 20 character wide by 10 lines text input box to work.

import tkinter.scrolledtext as tkscrolled
import tkinter as tk

default_text = '1234'
width, height = 20,10
TKScrollTXT = tkscrolled.ScrolledText(10, width=width, height=height, wrap='word')

# set default text if desired
TKScrollTXT.insert(1.0, default_text)
TKScrollTXT.pack(side=tk.LEFT)

The scroll bars show up once reaching the height as defined in the call. They are grayed out and blend into the background well. It works great..... once you figure out the correct calls to make.

I hope this is relevant to your question!

๐ŸŒ
AskPython
askpython.com โ€บ home โ€บ tkinter text widget with tkinter scrollbar
Tkinter Text Widget with Tkinter Scrollbar - AskPython
February 16, 2023 - You can see the scrollbar to the right, supported by the text widget to the left. Hopefully, you can build upon this to add more widgets to your GUI application, and make it more interesting! In this tutorial, we learned how we could add simple text widgets to our Tkinter Application, and also add scrollbars to support larger texts.
๐ŸŒ
Python Tutorial
pythontutorial.net โ€บ home โ€บ tkinter tutorial โ€บ tkinter scrollbar
Tkinter Scrollbar - Python Tutorial
April 4, 2025 - Add a Scrollbar widget to scrollable widgets like Text widget. ... Tkinter Hello, World!
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ how-to-attach-a-vertical-scrollbar-in-tkinter-text-widget
How to attach a vertical scrollbar in Tkinter text widget?
# Import the required library from tkinter import * from tkinter import ttk from tkinter import messagebox # Create an instance of tkinter frame win=Tk() # Set the geometry win.geometry("700x350") # Add a Scrollbar(horizontal) v=Scrollbar(win, orient='vertical') v.pack(side=RIGHT, fill='y') # Add a text widget text=Text(win, font=("Georgia, 24"), yscrollcommand=v.set) # Add some text in the text widget for i in range(10): text.insert(END, "Welcome to Tutorialspoint...\n\n") # Attach the scrollbar with the text widget v.config(command=text.yview) text.pack() win.mainloop()
๐ŸŒ
Python
docs.python.org โ€บ 3 โ€บ library โ€บ tkinter.scrolledtext.html
tkinter.scrolledtext โ€” Scrolled Text Widget
The tkinter.scrolledtext module provides a class of the same name which implements a basic text widget which has a vertical scroll bar configured to do the โ€œright thing.โ€ Using the ScrolledText class is a lot easier than setting up a text ...
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ python-tkinter-scrolledtext-widget
Python Tkinter - ScrolledText Widget - GeeksforGeeks
July 12, 2025 - The tkinter.scrolledtext module provides the text widget along with a scroll bar. This widget helps the user enter multiple lines of text with convenience. Instead of adding a Scroll bar to a text widget, we can make use of a scrolledtext widget ...
๐ŸŒ
Home and Learn
homeandlearn.uk โ€บ tkinter-scrollbars.html
Python TKinter Scrollbars
How to Add scrollbars to a Tkinter text widget using Python code.
๐ŸŒ
Tutorialspoint
tutorialspoint.com โ€บ python โ€บ tk_scrollbar.htm
Tkinter Scrollbar
This widget provides a slide controller that is used to implement vertical scrolled widgets, such as Listbox, Text and Canvas. Note that you can also create horizontal scrollbars on Entry widgets.
Find elsewhere
๐ŸŒ
Tk Tutorial
tk-tutorial.readthedocs.io โ€บ en โ€บ latest โ€บ scrollbar โ€บ scrollbar.html
Scrollbar โ€” Tk tutorial 2020 documentation - Read the Docs
"""Canvas with a scrollbar.""" from tklib import * class Canvas(tk.Canvas): def __init__(self, scroll='', scrollregion=(0, 0, 1000, 1000), **kwargs): self = Scrollable(tk.Canvas, scroll=scroll, scrollregion=scrollregion, **kwargs) class Demo(App): def __init__(self): super().__init__() text = 'hello ' * 100 Label("Canvas with scrollbars", font="Arial 18") h = 80 Label('scroll=') Canvas(height=h) Label('scroll=x') Canvas(height=h, scroll='x') Label('scroll=y') Canvas(height=h, scroll='y') Label('scroll=xy') Canvas(height=h, scroll='xy') Demo().run() scrollbar5.py ยท http://effbot.org/zone/tkinter-scrollbar-patterns.htm
๐ŸŒ
Rip Tutorial
riptutorial.com โ€บ connecting a vertical scrollbar to a text widget
tkinter Tutorial => Connecting a vertical scrollbar to a Text widget
The scrollbar needs to be expanded vertically so that it has the same height as the widget. text = tk.Text(parent) text.pack(side="left") scroll_y = tk.Scrollbar(parent, orient="vertical", command=text.yview) scroll_y.pack(side="left", expand=True, ...
๐ŸŒ
YouTube
youtube.com โ€บ watch
Connect One Scrollbar To Multiple TextBoxes - Python Tkinter GUI Tutorial 196 - YouTube
In this video I'll show you how to link multiple widgets, like text boxes, with one scrollbar.This method will work with anything that uses a Scrollbar with ...
Published ย  November 2, 2021
๐ŸŒ
Python Guides
pythonguides.com โ€บ python-tkinter-scrollbar
How To Create Scrollable Frames With Python Tkinter?
March 19, 2025 - Applying a scrollbar on the Frame is the easiest and the best way of doing it. Simply put both (scrollbar & other widgets) inside the frame window and then pack them in opposite directions. For example, pack the scrollbars on the right and other widgets on the left.
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ how-to-attach-a-scrollbar-to-a-text-widget-in-tkinter
How to attach a Scrollbar to a Text widget in Tkinter?
In order to add a scrollbar in the text widget, we can call the ScrolledText(root) function. This function generally creates a text field with a scrollbar. The ScrolledText(root) function resides in Tkinter ScrolledText Module.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ scrollable-frames-in-tkinter
Scrollable Frames in Tkinter - GeeksforGeeks
April 28, 2025 - Now let us look at the code for attaching a vertical and horizontal scrollbar to a Text Widget. ... # Python Program to make a scrollable frame # using Tkinter from tkinter import * class ScrollBar: # constructor def __init__(self): # create root window root = Tk() # create a horizontal scrollbar by # setting orient to horizontal h = Scrollbar(root, orient = 'horizontal') # attach Scrollbar to root window at # the bootom h.pack(side = BOTTOM, fill = X) # create a vertical scrollbar-no need # to write orient as it is by # default vertical v = Scrollbar(root) # attach Scrollbar to root window on
๐ŸŒ
ttkbootstrap
ttkbootstrap.readthedocs.io โ€บ en โ€บ latest โ€บ api โ€บ scrolled โ€บ scrolledtext
ScrolledText - ttkbootstrap - Read the Docs
A text widget with optional vertical and horizontal scrollbars. Setting autohide=True will cause the scrollbars to hide when the mouse is not over the widget. The vertical scrollbar is on by default, but can be turned off.
๐ŸŒ
Python Assets
pythonassets.com โ€บ posts โ€บ scrollbar-in-tk-tkinter
Scrollbar in Tk (tkinter) | Python Assets
April 12, 2023 - How to use the `tk.Scrollbar` and `ttk.Scrollbar` widgets to create, configure and style vertical and horizontal scrollbars in Python and Tk applications.
๐ŸŒ
GitHub
gist.github.com โ€บ taleinat โ€บ 985f1d47ea73b133b2faed77bd88d928
Python Tkinter Scrollable Text ยท GitHub
Python Tkinter Scrollable Text ยท Raw ยท scrollable_text.py ยท This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
๐ŸŒ
Python Tutorial
pythontutorial.net โ€บ home โ€บ tkinter tutorial โ€บ tkinter scrolledtext
Tkinter ScrolledText - Python Tutorial
April 4, 2025 - Use the Tkinter ScrolledText widget to create a Text widget with an integrated vertical Scrollbar.