The Wayback Machine - https://web.archive.org/web/20220428143612/https://www.geeksforgeeks.org/python-tkinter-scrollbar/amp/

Python-Tkinter Scrollbar

Python offers multiple options for developing a GUI (Graphical User Interface). Out of all the GUI methods, Tkinter is the most commonly used method. It is a standard Python interface to the Tk GUI toolkit shipped with Python. Python with Tkinter is the fastest and easiest way to create GUI applications. Creating a GUI using Tkinter is an easy task.

Note: For more information, refer to Python GUI – tkinter

Scrollbar Widget

The scrollbar widget is used to scroll down the content. We can also create the horizontal scrollbars to the Entry widget.

Syntax:
The syntax to use the Scrollbar widget is given below.

w = Scrollbar(master, options) 

Parameters:



Options:
Following are commonly used Option can be used with this widget :-

Methods:
Methods used in this widgets are as follows:

Example:




from tkinter import *
  
root = Tk()
root.geometry("150x200")
   
w = Label(root, text ='GeeksForGeeks',
          font = "50"
  
w.pack()
   
scroll_bar = Scrollbar(root)
  
scroll_bar.pack( side = RIGHT,
                fill = Y )
   
mylist = Listbox(root, 
                 yscrollcommand = scroll_bar.set )
   
for line in range(1, 26):
    mylist.insert(END, "Geeks " + str(line))
  
mylist.pack( side = LEFT, fill = BOTH )
  
scroll_bar.config( command = mylist.yview )
   
root.mainloop()

Output:




Article Tags :