PythonTkinter Scrollbar (original) (raw)

Python-Tkinter Scrollbar

Last Updated : 26 Mar, 2020

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:

Similar Reads

Tkinter Button Widget






















Label Widget










Entry Widget










Frame Widget








RadioButton Widget


CheckButton Widget




ListBox Widget






ScrollBar Widget