Python Tkinter ListBox Widget (original) (raw)

Last Updated : 25 Apr, 2025

Tkinter is a GUI toolkit used in python to make user-friendly GUIs.Tkinter is the most commonly used and the most basic GUI framework available in python. Tkinter uses an object-oriented approach to make GUIs.

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

ListBox widget

The ListBox widget is used to display different types of items. These items must be of the same type of font and having the same font color. The items must also be of Text type. The user can select one or more items from the given list according to the requirement.

Syntax:

listbox = Listbox(root, bg, fg, bd, height, width, font, ..)

Optional parameters

Common methods

Example 1:

Python3

from tkinter import *

top = Tk()

listbox = Listbox(top, height = 10 ,

`` width = 15 ,

`` bg = "grey",

`` activestyle = 'dotbox' ,

`` font = "Helvetica",

`` fg = "yellow")

top.geometry(" 300x250 ")

label = Label(top, text = " FOOD ITEMS")

listbox.insert( 1 , "Nachos")

listbox.insert( 2 , "Sandwich")

listbox.insert( 3 , "Burger")

listbox.insert( 4 , "Pizza")

listbox.insert( 5 , "Burrito")

label.pack()

listbox.pack()

top.mainloop()

Output:

python-tkinter-listbox

Example 2: Let’s Delete the elements from the above created listbox

Python3

Output:

python-tkinter-listbox

Similar Reads

Tkinter Button Widget






















Label Widget










Entry Widget










Frame Widget








RadioButton Widget


CheckButton Widget




ListBox Widget






ScrollBar Widget