VOOZH about

URL: https://www.geeksforgeeks.org/python/pyqt5-qlistwidget-python/

⇱ PyQt5 QListWidget | Python - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

PyQt5 QListWidget | Python

Last Updated : 12 Jul, 2025

In PyQt5, QListWidget is a convenience class that provides a list view with a classic item-based interface for adding and removing items. QListWidget uses an internal model to manage each QListWidgetItem in the list. Syntax:

listWidget = QListWidget()

There are two ways to add items to the list. 

  1. They can be constructed with the list widget as their parent widget.
QListWidgetItem("Geeks", listWidget)
QListWidgetItem("For", listWidget)
QListWidgetItem("Geeks", listWidget)
  1. They can be constructed with no parent widget and added to the list later.
listWidgetItem = QListWidgetItem("GeeksForGeeks")
listWidget.addItem(listWidgetItem)

Some of the most frequently used methods in QListWidget:

addItem() : To add QListWidgetItem object in list
addItems() : To add multiple QListWidgetItem objects
insertItem() : It adds item at specified position
clear() : To delete all the items present in the list
count() : To count number of items present in the list

Below is the code - 

Output : 👁 Image

Comment
Article Tags: