VOOZH about

URL: https://www.geeksforgeeks.org/python/how-to-remove-all-items-in-a-qlistwidget-in-pyqt5/

⇱ How to remove all items in a Qlistwidget in PyQt5? - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

How to remove all items in a Qlistwidget in PyQt5?

Last Updated : 23 Jul, 2025

Prerequisite:

There are so many options provided by Python to develop GUI applications and PyQt5 is one of them. PyQt5 is a cross-platform GUI toolkit, a set of python bindings for Qt v5. One can develop an interactive desktop application with so much ease because of the tools and simplicity provided by this library.

In this article, we will learn how to remove all items from QlistWidget in PyQt5. To achieve the required functionality i.e. to cleaning the window or deleting all elements using Qlistwidget in Python, its clear() method is used.

Syntax:

clear()

Approach

  • Import module
  • Create QListWidget
  • Add title and button
  • Add mechanism to delete all items of the list when the button is pressed
  • Display window

Program:

Output:

Comment
Article Tags: